You might consider following them out the door, and calling to them as they walk away - "Excuse me. I was attempting to answer your question. Can I help you?"

This puts the onus squarely back on them, and in a public setting. Their choice is to be publicly rude to you, or acknowledge the conversation. I'd wager it doesn't happen more than a couple times after that.