I feel the answer depends. How long ago did this person confess their feelings to you and got turned down? Have they moved on and found someone else?

 If yes, then I guess it doesn't hurt to extend an invitation. If they have truly moved on and are in a happy and healthy relationship with their SO, seeing you and your bride or bridegroom hay together won't rankle much, if at all. 

But on the other hand, if the rejection has occurred recently and they still haven't found someone, and if they wanted to be your SO, not just an FWB or a situationship, I think it's best not to invite them. 

Seeing you with another man or woman will be even more devastating. If you care for them at all, don't do it. 

If they are particularly close to you, don't ask them to be a best man or best woman. 

I know being the best man or best woman at the wedding of someone you have feelings for is a popular trope, but it can be emotionally vexing for the individual. They have to be consummate actors, pretend to be delighted for you and your partner, and pay tributes to your romance without sounding bitter or cryptic. 

It's honestly too much. 

If they are a close friend, sure, their absence at your wedding may raise some eyebrows. But if you care for them, braving some awkward questions is better than deliberately making them feel awful. 

Ofc they will come to know that you have been married. They may ask why you didnt invite them, think of an answer. Or maybe just tell them the truth.