I know many people don't recommend WD-40, but would WD-40 work in this case? Spray some on, wait a few minutes, try folding back and forth, and then do the hammering as a last resort. My old bike was outside for many years and WD-40 helped me in the very rusted areas to remove parts off the bike.
I could be wrong though, but just dropping an idea.