Well ... some do just decide to screw with the retail worker, and some people are just that way. They'll beat you down if you let it happen.
What always worked for me, pretty simple really, is to remember that you're really just performing - no different than an actor playing a role. The customer may or may not know that, but it doesn't really matter because they're mostly working off a script to even if they don't realize it. None of the normal business-type interactions feel personal that way. Even when some moron stalks off insulting you, and I've had that happen, you can laugh it off because they are reacting to the role (and don't have a clue about it).