It's not okay to lead someone on.
John finds out that Mary has a crush on him.
John wants to get Mary to stop flirting with him.
John directly informs Mary that he isn't interested in a relationship.
John acts ambiguous around Mary, hoping she'll get the message.
Mary is disappointed, but gets over it, and is able to refocus her attentions elsewhere.
Mary thinks there's a chance, and wastes a lot of time and energy pursuing John, and is ultimately hurt.