Look at the verse you cited more precisely, it then adds "after it has become clear to them that they are companions of Hellfire".
This is also stated about Ibrahim --peace be upon him-- when he promised he will ask Allah to forgive his father (uncle indeed) and this is the one respect we shouldn't follow him although he is a good pattern according to [60:4]:
There is for you an excellent example (to follow) in Abraham and those
with him, when they said to their people: "We are clear of you and of
whatever ye worship besides Allah: we have rejected you, and there has
arisen, between us and you, enmity and hatred for ever,- unless ye
believe in Allah and Him alone": But not when Abraham said to his
father: "I will pray for forgiveness for thee, though I have no power
(to get) aught on thy behalf from Allah." (They prayed): "Our Lord! in
Thee do we trust, and to Thee do we turn in repentance: to Thee is
(our) Final Goal.
Asking for forgiveness for such people is like Noah --peace be upon him-- asking Allah for rescuing his son from the flood which is again forbidden for him (although what he did was not a sin either, clearly), see [11:37,40,45,46,47]:
"But construct an Ark under Our eyes and Our inspiration, and
address Me no (further) on behalf of those who are in sin: for they
are about to be overwhelmed (in the Flood)."
At length, behold! there came Our command, and the fountains of the
earth gushed forth! We said: "Embark therein, of each kind two, male
and female, and your family - except those against whom the word has
already gone forth- and the Believers." but only a few believed with
And Noah called upon his Lord, and said: "O my Lord! surely my son
is of my family! and Thy promise is true, and Thou art the justest
He said: "O Noah! He is not of thy family: For his conduct is
unrighteous. So ask not of Me that of which thou hast no
knowledge! I give thee counsel, lest thou act like the ignorant!"
Noah said: "O my Lord! I do seek refuge with Thee, lest I ask Thee for
that of which I have no knowledge. And unless thou forgive me and have
Mercy on me, I should indeed be lost!"