What is so wrong with the prayer of the Pharisee? Why does he not go home 'justified', like the tax collector? At first sight, it's clearly his spiritual pride that gets in the way of a true relationship between him and God. He's so concerned with his own moral purity, and wants to exaggerate it by reference to the visible 'sinners' in society. St Luke highlights this point in the way he introduces the parable: Jesus is actually addressing these same 'people who prided themselves on being virtuous and despised everyone else' (v.9).
In context, however, it's not so simple as that. The Pharisee's prayer is quite a natural one up to a point: he is giving thanks for the privilege of leading a life which encourages fidelity to God's Law. His position in society enables him to keep the Law punctiliously, with extra latitude for supererogatory fasting and tithing. By contrast, the tax collector's profession made him de facto a sinner against the Law, since he could only make a living to the degree that he defrauded others. Can we blame the Pharisee for thanking God in this way, especially when we remember that to give thanks (eucharisto, v.19) was seen as the most noble kind of prayer?
We might think: if only the Pharisee had given thanks to God without despising his fellow worshipper!
But the Pharisee is spiritually blind, turned inwards in self-congratulation – a kind of idolatrous self-worship. St Luke provides a little detail which might make the point with delicious irony: note that the Pharisee said his prayer to himself (v.11). Although this simply means he wasn't speaking out loud for others to hear, it could also indicate that he wasn't really talking to God in the first place...