The core problem here is that the child is behaving in a way that you do not want them to behave in.
I find that the best way is to treat them like foolish and inexperienced adults from the start. What do you do when an adult does something that you don't want them to do?
-"Please don't do that" -"why not?" -explanation
You'll have to engage in a debate now, much as you might with a spouse or roommate. If the child has a convincing argument, then allow yourself to be convinced. If the child's preference is strong, consider a compromise. Obedience isn't the goal here - the goal is to create an effective and autonomous person.
If you find that the behavior is really, truly unacceptable, you pull out the trump card: "If you do X, I will be sad and disappointed in you." Don't overuse this - it's actually very distressing to a child (Imagine if a friend or SO said that to you). Only use this when you would actually be sad and disappointed, or you will come across as emotionally manipulative and possibly transfer that behavior to the child.
And if that doesn't work, there is really nothing you can do, and it might be time to instill more coercive measures. However, do consider that most psychologically normal children will feel emotionally compelled to remedy the situation, in order to retain good standing within the tribe. The fact that they still aren't listening means that they've got a severe emotional pull in the other direction, and you've trapped them between a rock and a hard place. Assuming a child has no mental abnormalities, you should consider the notion that your demands might actually be unreasonable.
The main trouble with my approach is that parents are often old and tired people, who are unable to sustain debate with energetic children. I see older parents try this approach, and find themselves consistently losing arguments because they are too impatient to finish them...which is when they switch to lazy shortcuts, such as playing the part of an authority and placing external consequences on behavior.
I've got no idea how to deal with the problem of limited parental energy, other than recommending that those who are suffering from it take measures in exercise and nutrition to improve their mental and physical health. Just consider though - if this were an adult, you'd have to do it the hard way. You couldn't just impose your will. Imposing your will is cheating.
Disclaimer - I haven't raised children - these are just my interactions with parents, interactions with children, and a fairly recent experience of childhood. Also, among the people who i know that have what I judge to be healthy attitudes towards morality and authority most report being raised in this sort of way (not sure if cause or effect - it's possible that the type of child you have influences your parenting style).
If the child's preference is strong, consider a compromise.
If you mean strong in comparison with your own preference that they don't do that, I don't think that would work. It would just incentivize the child to always have very strong preferences. To want that they want right now very strongly. The child would become a little utility monster.
Theoretically it might work if you mean "strong compared to the child's other preferences". Then you might tell the child, "if you eat this icecream, your belly will hurt later". But children do much more time discounting than adults, so that's hard too.
Followup to: Strategic ignorance and plausible deniability
My in-law always says: "For children it is easier be forgiven then to get permission."
EDIT: This post is superseeded by my Book Review: Kazdin's The Everyday Parenting Toolkit I recommend reading only that. The remaining insight of this post is: Children expend more brain power on their parents than the parents on them.
I can say from experience: That is risky.
Children (esp. small ones) expend significantly more brain power on their parents than the parents on their children (your mileage may vary). I can assure you that they will notice these cases - at least some - and take that into account one way or the other.
If the children notice this they may assume that you either condone, accept, bear or ignore it. None of these has positive effects.
Possible alternative strategies:
I am influenced by The Adlerian School. Of relevance here is Striving for significance.
The testing of limits and the resulting interaction with the parent give the child a feeling of significance if the parent acknoledges the act of the child even if he doesn't agree with it. On the other hand ignoring the act of the child is negative feedback about significance.
EDIT: The asymmetry between parents and children with respect to the effectiveness of deniability can be generalized to any situation where one actor has significantly less overall information about the situation than another actor and thus might not be able to reliably estimate whether deniability is possible.
ADDED: tadamsmar pointed out that ignoring is scientifically known to be effective and the advice or rather personal expierence I have related in this post may be contraproductive (at least if applied in isolation).