Be aware when beating the bolt with a sledge hammer, you're bending the frame on the opposite side of the bike.
If the bolt is welded inside of the engine cases from rust, when you hit the bolt it pushes the engine into the frame putting stress on it.
You have a few options.
Try to get it out with the heat & beat method.
If the bolt is rusted inside of the engine case - turn the bolt with a wrench to help it break free of the rust.
If the bolt turns freely, it's probably rusted to the collars.
Try to grab them (one at a time) with a pair of vice grip pliers and work the bolt free - use heat from a propane torch.
One of my bikes I had to strip it down to just the frame and swingarm.
Then put the frame in a 10 ton press.
Another bike, I cut the bolt with a hack saw.
There isn't much room to work - the blade had to be removed from the saw and took forever - it had to be done twice (once on each side of the engine).
Instead of using a hack saw blade if you have enough room, you can cut the bolt with a die grinder and "cut off wheel".
http://search.harborfreight.com/cpisearch/web/search.do?keyword=cut+off+wheel&Submit=Go
WD40 is crap and won't do a thing.
It's not even a lubricant - it says on the can "rust inhibitor"
I just prevents rust.
Go to an auto parts store and purchase rust remover.
http://www.harborfreight.com/cpi/ctaf/displayitem.taf?Itemnumber=96431
Let it seap into the bolt hole and tap the bolt a few times to help it seap into any free space.
Repeat every hour until you can turn the bolt with a wrench.