I had a "rattle flash" on my 40D - something else died on the body so I sent it to Canon, the flash didn't rattle when it came back.
Sent it off under warranty or return to the store if within a few days of purchase. Was the camera packaged as you would expect a new camera to be packaged? (retailers will sometimes put returned items back on the stock shelf and send out as new - not often, but it happens)