When I do macro photography, I turn the external flash on and off all the time by its switch. Dead easy way to control it. When off, the camera behaves as if there is no flash. I don't know if there is another way since that was so easy, there wasn't a need to look for another way.

My 50D did appear to detect if there was anything physically on the hotshoe, and if so, would prevent the popup flash from erm... popping up.