Can obstinacy in sin be forgiven in Catholic teaching? I've read that obstinacy in sin is unforgivable. Is it one of the sins against Holy Spirit and therefore cannot be forgiven? However, what if a sinner decides to stop being obstinate and repents? 

Can God forgive it then, or is it still unforgivable, no matter how much the sinner repents?
Obstinacy can be forgiven, like all sin, but only once it ceases.
According to Catholic teaching, the fundamental condition for receiving forgiveness is repentance founded on supernatural love for God, sometimes called perfect contrition. (When repentance is based on something less perfect, such as the fear of punishment, then it is called imperfect contrition.)*
The Catechism of the Catholic Church (CCC), reiterating the solemn teachings of the Council of Trent, describes contrition as follows:


Among the penitent's acts contrition occupies first place. Contrition is “sorrow of the soul and detestation for the sin committed, together with the resolution not to sin again” (quotation from the Council of Trent, Denzinger-Schönmetzer [DS] 1676).

When it arises from a love by which God is loved above all else, contrition is called “perfect” (contrition of charity). Such contrition remits venial sins; it also obtains forgiveness of mortal sins if it includes the firm resolution to have recourse to sacramental confession as soon as possible. (See DS 1677.)



Regarding the question of obstinacy, when a person commits a grave sin (also called a mortal sin), that very action is incompatible with having God’s grace in his soul. One of mortal sin’s effects, therefore, is to destroy our capacity to love God supernaturally—in other words, after sinning gravely, we are incapable of exercising charity. (See CCC 1855.) Such a sin is called “mortal” precisely because it renders the soul spiritually dead.
But as explained above, perfect contrition entails an exercise of charity; therefore, mortal sin would leave us permanently separated from God if He did not intervene in order to rescue us. When a person is moved to repentance, therefore, it is because God moves him to act—the unaided sinner is incapable of true repentance.
It is, however, always within our power to reject God’s action in our soul. It is possible for us to remain attached to our sin, and to refuse to repent. This refusal to cooperate with God, by definition, is what obstinacy consists in.
Without repentance, of course, forgiveness is impossible. God will not force His grace into our souls if we do not want it.
Of course, once the obstinacy ceases, and we are willing at least to take the first steps toward repentance (beginning, usually, with imperfect contrition, which, with the help of God, blossoms into perfect contrition), then forgiveness becomes possible.
(For Catholics, Orthodox, and other churches that retain all seven sacraments, the ordinary way to obtain that forgiveness is through the Sacrament of Reconciliation. In fact, one of the effects of this sacrament is to transform imperfect contrition into perfect contrition, should that be necessary.  See CCC 1453.)

* In some theological writings, one will find the term contrition (without qualification) in opposition to attrition. When used in this way, the two terms are exactly equivalent to perfect contrition and imperfect contrition—it is just a slightly different terminology describing the same reality.