Why doesn't he tell me that he has a girlfriend?

Me and the guy that I like are part of the same group of friends and we're in the same class. He told everyone in the group that he has a girlfriend (she was his ex), but he didn't tell me and continues not to tell me. We were at a picnic yesterday and he was talking with our friend about his girlfriend, and when he saw me coming towards them he told her "this conversation ends here".
Now I need to say that I liked him since the beginning of the school year and I'm 100% sure that at one point he liked me back. But of course going back to his ex was easier than trying to be in a relationship with someone new. Also, for some reason, I always act cold and a little mean around him so he probably thought that I didn't like him and that's why he went back to her. When he talks about her and when he texts her, he never smiles. I seriously never saw him smile when talking about her.
Anyways sometimes we when look at each other I feel like there's something going on between us. He gives me some type of look that makes me think that he still likes me, even though he's with her.
Now, what I don't understand is why he doesn't tell me that he has a girlfriend? If he doesn't like me then he shouldn't have any problem saying that he has girlfriend, because if I were him I would say that I have a girlfriend to let the other girl know that I don't like her that way. My friends say that he maybe is trying to keep me around just in case they break up, just like a backup. But I don't think so because he's not like that.
What do you think?
Why doesn't he tell me that he has a girlfriend?
Add Opinion