Here's a solid explanation from St. Augustine:
The garment that is required is in the heart, not on the body, for if it had been put on externally, it could not have been concealed even from the servants. But what is the wedding garment that must be put on? We learn it from these words, “May your priests be clothed with righteousness” (Ps 132:9). It is of that garment of righteousness that the apostle speaks when he says, “Because when we are clothed, we are not found naked” (2 Cor 9:3). In this way the unprepared man was discovered by the Lord of the feast, interrogated, bound and thrown out, one from among the many.
He goes on to say:
What is that wedding garment, then? This is the wedding garment: “The goal of this command is charity,” says the apostle, “which comes from a pure heart and a good conscience and a sincere faith” (1 Tim 1:5). This is the wedding garment. Not charity of any kind whatever—for very often they who are partakers together of an evil conscience seem to love one another. Those who commit robberies together, who love the destructive arts of witchcraft, and who go to the coliseum together and join together in the shout of the chariot race or the wild beast fight—these too in some sense very often may be said to love one another.
But in these is no charity from a pure heart, a good conscience and a faith unfeigned. The wedding garment is charity such as this: “Though I speak with the tongues of men and of angels and have not charity, I have become like a sounding brass and a tinkling cymbal” (1 Cor 13:1). Suppose someone who speaks in tongues comes in and is asked, “How did you get in here without a wedding garment?”
Suppose he answers, “But I have the gift of prophecy and understand all mysteries and all knowledge, and I have all faith, so that I could remove mountains.” But if he has no charity, he has nothing. Such may be the clothing of those who in fact lack the wedding garment. “Though,” he says, “I have all these and have not (the love of) Christ, I am nothing.” Is then “the gift of prophecy” nothing? Is then “the knowledge of mysteries” nothing? It is not that these are nothing. But “I, if I have them, and have not charity, am nothing” (1 Cor 13:2).
(SERMON 90.4; 90.6)