Oh, white, and for cafe as well, nothing beats a, 'What an insensitive and thoughtless thing to say. That's really hurtful.' Walk off if you can. If you can't and they answer, 'The truth hurts,' reply, 'And most intelligent adults are already well aware of it, that's why, in adulthood, it's sometimes much better to keep certain thoughts to oneself, especially when they're unsolicited, as to do otherwise is to be hurtful and mean.' 'Wow, I hadn't taken you for a mean-spirited person. I hope saying such an ill-thought-out and tactless thing is just a one-off.'
If it's another professional, a simple, 'What a shockingly unprofessional thing to say! How embarrassing!' 'Are you in the habit of being unprofessional?' 'As this is a professional setting, and we have to work together, things will flow so much more easily if we both demonstrate mutual respect/patience/tact/you-name-it,' (add in, 'Wouldn't you agree?' for added passive aggressive bitchiness).
Or, if you really want to cut, then compare them to another professional who's admired. 'I'm so sorry, you see, I'm used to working with X, who is an absolute paragon of courtesy, tact and professionalism. Please give me a moment to adjust. My apologies.' Or, when X's name is mentioned, interject a, 'X is truly a remarkable example to those of us in the profession. I can only hope to be able to demonstrate such (insert virtue of your choice) in addition to being so (clever, accomplished, etc.).'
Practice saying things like this in front of a mirror, in your car, whilst doing the washing up. And it's like using an ice axe to self-arrest: you'll find yourself doing it without even thinking when put in that situation.