I'd wager "Megaman"/"MegaMan" has been used officially, but overall the standard seems to be "Mega Man" (The Protomen, though, use the "-man" form[e]).
That seems just about right. I have seen it spelled "Mega Man" more commonly, but like you said, officially (and in game) it seems to be spelled "Megaman", and that's how I usually spell it.