I have a 13 yo son and 11 yo daughter so I know where you are coming from. As their parent, at this point in the game, I can make them get back in there if I think they need to. I mean, I can tell them that they *are* going to spar in the next tournament. I don't do it roughly or anything, I am considerate and encouraging, but I have the authority, if you will, to sign them up and drive them out and make them do it, so to speak. (The fact that I'm there as well probably helps).
So...talking to the child's parents may help. See if you can get them 'on your side' so to speak to encourage the student to keep at it.
One thing I talk to my kids about is learning to focus. As adults, we know how to focus on the goal and not on the pain, so to speak, but kids don't naturally know that and need to learn that...and sometimes need to be pushed through it. You get kicked and it hurts. Mentally you can focus on the pain and wrap yuor mind around it so that's all you notice, or you can focus on the goal and push past the pain. That helps a lot in cotinuing to fight regardless of pain or discomfort or even whether you are losing or winning or not.
One thing we talk about in class a lot is that if you are on the street, the 'bad guy' is not going to stop just because you took a shot that knocked the wind out of you or you got kicked and bruised or something. Yes, a real injury is worth stopping for, but in the sense of sparring and training for adversity, just getting 'hurt' is not sufficient to stop the match and to back out and cry over because when it matters, that's just going to get you hurt more.
As Navarre said, unless you have a very small circle of competition, the next match will be against someone else, so worrying about that one opponent is not productive. Remind the student of when he has done well, of any wins or any other successfull encounters he has had. Remind him of past successes to get him away from fretting over past failures.
Also, talk about the match he lost. Focus on he things he did well "remember when you XXX and it *worked*, don't forget to do that again, that was very effective" and also on some of the negatives, " he kicked you in the head because you let your hands drop and left yourself open...lets work on keeping the hands up" and also find techniques and approaches that were effective *against* your student and use them as examples. "Did you notice how he used switch stances and quick attacks to get you off your guard, that's something you can do, too...it's an effective technique" It helpls if you can get him not to thing of the match as "I got beat" and start thinking of it more objectively and think not about the fact that he got beat but *how* and *why* and what he can learn from that in being more effective as well as not making certain mistakes
One thing that may help is to basically treat him as if you assume he's going to compete again. Don't trat him like he's quitting, treat him like he's going to go into the ring again and you expect him to do well. It will be easy for him, at 12, to pick up on any negative in the sense of if you treat him like he won't fight again, then that will be something he uses to reinforce and justify his thoughts and decisions. If you treat him like you fully expect and assume him to spar again, that could help strengthen his resolve.
I only use 'he' in a general sense. You didn't indicate if the student was boy or girl and I have two daughters in TKD, so I don't realy assumme it's 'he'