Is it true that bees and wasps don't sting if struck by hand while they are in flight?
I can confirm that I have often enough slapped a wasp or bee in flight without being stung. The reason is probably pure chance. 

It is kind of like asking if a human can bite when slapped. If I come up to you and slap you, fast and hard, you will probably not be able to bite my hand because of surprise and the blinding speed with which I hit you. If, however, you happen to be talking to me and have your mouth open at the time, you might be able to pull off a quick bite.

In a similar vein, if I happen to swap a wasp (no anagram intended) and hit it on the sting, I will probably be stung. If I hit it on the side and move fast enough, I doubt it will have the time to reorient itself and sting me before my hand is gone.