It's part of life that "Our face does not fit." or the boss is prejudiced, for whatever reason. Like Swami Parthasarathi says, "A man may be seeking divorce from his wife, but at the same time there may be another man just waiting for the divorce to get married to the same woman.*
Let me give a couple of examples that I have come across. A Dutchman once said that he was not prejudiced like the English. I asked him "If there are 4 equally qualified applicants for a job, is there anyone that you would not employ?" he replied "An Italian." That's for non-perceived prejudice. In the second case, an Asian was not given promotion, in the UK; however, he had been advised to apply for job 3 levels higher, in India. When the employee spoke to the manager, his response was "I am sure you can do that in your own culture."
If your discussing with the manager and HR does not bear fruit, your options are to quit and seek job elsewhere (There is no guarantee that your present boss does not also do the same and becomes your new boss.) or fight it out legally, if the cause is either Sexual Discrimination or religious discrimination.