Once while I was taking pictures, the pop-up flash was blocked by my cap. Now, it no longer opens. How can I fix this?
There is physical damage to the flash pop-up mechanism (such as a spring popped out), and you should take it to a camera store.
You have switched to a different mode where the flash won't pop-up automatically, or your flash is on "auto" and the camera doesn't think it needs flash. It will usually pop up automatically if the flash is in "auto" mode, or the camera is in "full auto" mode, and the camera thinks it needs flash.
I partially seem to understand your question, though, lets assume you were wearing a hat and when popping up your built-in flash, your hat obstructed and ever since the flash does not pop up.
If this is the case the small spring in the pop up flash element has been displaced and it is advisable to give it to a authorized service center to get it repaired.
Temporarily you will have to press the pop-up flash button to release the clutch and pull it up manually, but I think it would refrain from dropping back into position if you let go of the flash element. Block it from shutting off with a tiny obstruction like a piece of straw/matches or something.