There is a phrase in French that exactly means this: "la douleur exquise"
It literally means "the exquisite pain" and expresses the pain of wanting the affection of someone unattainable. I think it is not used as a loan phrase in English and the translation does not make much sense.
Is there an equivalent word or phrase in English?
Sometimes, platonic love is used in this sense (though not exactly for the pain) but it is actually an emotional relationship without sexual desires. I'm not sure if there is a semantic shift in the meaning though.
“Unrequited love” describes a relationship state, but not a state of mind. Unrequited love encompasses the lover who isn’t reciprocating, as well as the lover who desires. La douleur exquise gets at the emotional heartache, specifically, of being the one whose love is unreciprocated.