It would be illegal to refuse to allow them to do their job if they properly identified themselves as officers, and those officers had some kind of court order authorizing them to seize a car for example. But these are undercover agents posing as legitimate customers - a completely different scenario.
>For dealing with individuals, I don't agree that it's ok to use every resource at their disposal. For example, getting the person fired or slandering them is not acceptable.
I agree with this, but your government doesn't. Imagine you are falsely accused of a crime. You are quite likely to be fired, you will certainly be publicly slandered, and you may lose family and friends over it. It will take years and substantial amounts of money to clear your name, and when you do, most of the damage will have already been done anyway. In the end, you won't even receive as much as an apology.
The government doesn't offer you the same kind of mercy that you believe you should afford to others. So there's no reason to afford the government or anyone employed by it any courtesy beyond the bare minimum to which they are legally entitled. In the case of an unannounced undercover agent, they are nothing more than fellow humans with absolutely no special rights.