There are no stupid questions. There are only stupid people who ask questions.
Man: No kidding.
Woman: Can I buy this blouse as a separate from this skirt?
Man: I don't work here.
Often however, used in a sarcastic tone/context to make the other party look stupid. Making the asker very clever.
Closely related to the Rhetoric question.
Shut up, stop asking stupid question