Actually, "nonsense" (as well as "wood", "knowledge", etc.) are all singular noncount nouns.
Maybe the question should not be when to use "what" vs. "what a". Maybe it's just a matter of saying that, in this type of expression, "what" precedes whatever the usual indefinite noun phrase normally...