When I was new to the industry I would always try to be nice, answer questions, and explain on what I was trying to do. I was still learning things like my company's equipment, software, and my own skills on the fly - so that made things difficult when it came to realizing if the person taking to me knew anything, giving constructive advice, or just being an asshat.
Now that I've learned a lot, when someone comes around being a prick and talking out of their arse I just tell them that I'll need some time alone to come up with a solution and I'll explain the solution when I'm finished. If I need any assistance during that time I'll come find them and let them know. Sometimes you can point them in a different direction and ask them to gather information from operators or other people around the shop and come back to you. Usually once people like that start walking around they'll forget what they were supposed to do and get sidetracked.
If they don't get what I'm throwing down and don't go away, then I'll close my computer and go to the bathroom or get a drink.
Still hanging around when I come back? That's when it's "Roadhouse: time to not be nice" time!
On the flip side: when someone comes around that does know something, then it's actually enjoyable to discuss the problem, theories, etc.