ConnectiCon 2013 had a ton of cosplay that I wish I got to photograph. At least half the people who attended were cosplaying on Saturday and Sunday. The vibe of the place was so friendly and the convention was so packed that I had to settle for a lot of "I love your [insert character here] cosplay" shouts of appreciation rather than quick photos. I have a really simple set of rules for photographing cosplay at conventions that I try not to break.
That's the big one. I always ask or I don't take the shot. The exceptions are when cosplayers at a convention are totally swamped with photographers (they've already consented) or cosplayers are roleplaying at the convention to entertain the crowds (they've already consented).
#2: Personal Space
If a cosplayer is taking a break (sitting down, eating, going to the bathroom, smoking, ripping off armor and being fanned down by a friend, etc.), I'm not going to ask to take the shot. I know I need lots of me time at a convention and try to find some quiet place to hide for a while, especially if I'm in cosplay. I extend that courtesy to other attendees.
#3: Physical Space
Unless I can find a safe place to take the photograph without significantly impeding traffic at the convention, I'm not going to ask for the photo. The fans come first. I don't want to be that guy that blocks a narrow hallway just because I saw the coolest crossplay Captain America with chainmail armor I've ever seen.
Those are the simple rules for me. The other part is a script for getting permission. It goes like this:
"Excuse me, [insert character name here if at all possible], may I get a photo. [Wait for response] [Take photo as quickly and efficiently as possible] Thank you very much. [If I'm not totally overwhelmed, hand over business card] Come check out your cosplay later at Sketchy Details."
That's how it goes. Here are the results of that method at ConnectiCon 2013.