Try some ambient at 3200 if you like but don't give up on flash.
First, remember that the maximum flash sync speed is 1/250 sec for the 40D. Set this in Manual mode. Faster shutter speeds will have problems.
Next, your flash has to dominate over the ambient light in order to avoid 'ghosting.' Strive to get your flash exposure to be 3 stops over ambient if possible (2 if you can't). So, if your camera properly exposes an image (without flash) at f/2.8, 1/250 sec, and ISO3200; you would like to set your camera on manual at f/2.8, 1/250 sec, ISO 400. Adjust your flash output to properly expose the image at these settings. That will allow you to 'freeze' the action with the flash and eliminate noise problems with the lower ISO. The ambient light will not 'blur' the image even at a slow SS of 1/250 because of the 3 stop adjustment in ISO.
The darker the gym, the better that flash will work.