One who knowingly and willingly refuses the truth (refuses to accept the salvation which God offers to man through the Holy Spirit), and dies outside of it cannot be saved. This is the unforgivable sin.
In the Encyclical
Dominum et vivificantem, Pope John Paul II explains why blasphemy against the Holy Spirit is unforgivable:
“Every one who speaks a word against the Son of Man will be forgiven; but he who blasphemes against the Holy Spirit will not be forgiven.”
Why is blasphemy against the Holy Spirit unforgivable? How should this blasphemy be understood ? St. Thomas Aquinas replies that it is a question of a sin that is “unforgivable by its very nature, insofar as it excludes the elements through which the forgiveness of sin takes place.”
According to such an exegesis, “blasphemy” does not properly consist in offending against the Holy Spirit in words; it consists rather in the refusal to accept the salvation which God offers to man through the Holy Spirit, working through the power of the Cross. If man rejects the “convincing concerning sin” which comes from the Holy Spirit and which has the power to save, he also rejects the “coming” of the Counselor-that “coming” which was accomplished in the Paschal Mystery, in union with the redemptive power of Christ’s Blood: the Blood which “purifies the conscience from dead works.”
We know that the result of such a purification is the forgiveness of sins. Therefore, whoever rejects the Spirit and the Blood remains in “dead works,” in sin. And the blasphemy against the Holy Spirit consists precisely in the radical refusal to accept this forgiveness, of which he is the intimate giver and which presupposes the genuine conversion which he brings about in the conscience. If Jesus says that blasphemy against the Holy Spirit cannot be forgiven either in this life or in the next, it is because this “non-forgiveness” is linked, as to its cause, to “non-repentance,” in other words to the radical refusal to be converted. This means the refusal to come to the sources of Redemption, which nevertheless remain “always” open in the economy of salvation in which the mission of the Holy Spirit is accomplished. The Spirit has infinite power to draw from these sources: “he will take what is mine,” Jesus said. In this way he brings to completion in human souls the work of the Redemption accomplished by Christ, and distributes its fruits. Blasphemy against the Holy Spirit, then, is the sin committed by the person who claims to have a “right” to persist in evil-in any sin at all-and who thus rejects Redemption. One closes oneself up in sin, thus making impossible one’s conversion, and consequently the remission of sins, which one considers not essential or not important for one’s life. This is a state of spiritual ruin, because blasphemy against the Holy Spirit does not allow one to escape from one’s self-imposed imprisonment and open oneself to the divine sources of the purification of consciences and of the remission of sins.
“As for certain lesser faults, we must believe that, before the Final Judgment, there is a purifying fire. He who is truth says that whoever utters blasphemy against the Holy Spirit will be pardoned neither in this age nor in the age to come. From this sentence we understand that certain offenses can be forgiven in this age, but certain others in the age to come.”[St. Gregory the Great, Dial. 4, 39: PL 77, 396; cf. Mt 12:31]
vatican.va/holy_father/john_paul_ii/encyclicals/documents/hf_jp-ii_enc_18051986_dominum-et-vivificantem_en.html
For further reading, I recommend the following:
ewtn.com/library/ANSWERS/HOW2PURG.htm
cin.org/users/james/files/unforgiv.htm