ITA . . . tell the child what you
want them to do, not what you want them NOT to do whenever it's at all possible.
OTOH, a lot of times I think they are testing the limits.
The other day my 5yo said, "But, Mommy, you've only asked me 4 times!" when I asked her to do something. It made me realize that I've actually trained my children to wait until the 5th or 6th time I asked them to do something before they act.
Now I'm working on making sure I get their attention and good eye contact, telling them once, and then making sure I follow through with helping them do it. If it's something important enough to ask/tell them to do it, then I need to treat it as important enough to not just keep asking over and over while they play for another 15-20 minutes before I actually follow through in making sure they do it.
They are learning all the time, and one of the things they are learning is exactly how much you mean it when you ask them to do something and whether you really care or not when they don't do it.
As a PP alluded to, also, I think little kids (and many adults!) differentiate between being asked or being told. If I'm asking (which is probably most of the time) I do allow for discussion/debate or even for the child to say no. If I'm telling them something important that I need them to do, then I need to make sure to use words and a tone that convey this.
My husband is actually the one that taught me this. I kept saying, "Would you like to . . . " or "Do you want to . . . " when I was asking him to do something, and he'd just say, "No, not really." Well, he
didn't actually have a burning desire to do whatever it was.

I finally learned to just say "Would you be willing to . . . " (which still leaves room for him to say no --appropriate in the vast majority of cases--while at the same time making it less dependent on his mood or desires). There are a lot of times when he certainly doesn't "want" to help me move a heavy object or whatever, but he's willing to. Or I will say, "I need help with this. Could you please do this or that?"
With both my husband and my kids (or anyone else, really), if it's not something that has to be done THAT INSTANT (like grabbing a falling object or child next to them), I try to ask in a way that doesn't require them to drop what they're in the middle of and do it immediately.
I'll say something like, "When you get to a good stopping place" or "When you finish that chapter in your book, then will you please do such-and-such", or give a timeline of when it needs to be done (i.e. "Could you please pick up that game before you get out another toy?" or "Would you please move your toothbrush off the kitchen table before it's time to set the table for dinner in 15 minutes?")
When you tell him something that you really need him to do/not do, can you convey in some way that it's important, and maybe even explain why?