I know it will still provide power and such but what are the potential safety hazards?
Actually, it's not that dangerous at all. If you're going to use an ungrounded extension cord (which is not recommended), plugging it into a GFCI receptacle mitigates much of the risk.
Having a grounding conductor in place, may prevent a fault condition from energizing grounded portions of a device (technically it won't prevent it, but it should trip the breaker). A GFCI should prevent you from being electrocuted, if you happen to come into contact with an energized portion of the circuit or device.
The proper thing to do, is to replace the extension cord. However, if you're going to use the cord, plugging it into a GFCI makes it a bit safer (assuming the GFCI is in good working order).
WARNING: A GFCI may not prevent you from being shocked, but it should prevent you from being electrocuted.
Well for one thing, the ground pin keeps you from plugging it in backwards. You know 2-prong plugs where one prong is taller than the other? The tall one is "neutral" which is close enough to ground that it's very unlikely to shock you. (it isn't ground and shouldn't be shorted to ground). Some homebrew or sloppily made equipment (Chinese LED bulbs come to mind) allow you to touch metal energized at "neutral". No biggie, unless you have managed to reverse the plug and then you have a problem. So if you have 3-prong outlets everywhere you plug this in, I'd put a 3-prong plug on the cord.
Another... factor... is GFCI (Ground Fault Circuit Interruptor). If any current leaks to ground (e.g. while shocking you), the GFCI will trip. That is so effective that the National Fire Protection Assoc. (who writes the Electrical Code) allows you to install a 3-prong GFCI outlet where there is no ground. So you can put GFCI's in your sites which have 2-prong outlets because they don't have ground.
The purpose of grounding is so that when a fault in the appliance happens that connects a live conductor to the case the current will flow through the grounding system and not through your body.
A GFCI goes some way to mitigating the risk from missing grounds, however it cannot stop you from getting an electric shock it can only cut off the shock current after the shock has begun, hopefully before the shock kills you.