Having said that God fulfills our requests that are in accordance with His will, the apostle now clearly expresses his desire concerning what we should ask for according to God's will. And since he spoke much, almost throughout the entire epistle, about love for one's brother and about the fact that God desires that we maintain love for our brother without hypocrisy, he now names as one of His desires, and the very best one, that when someone sees his brother sinning a sin that is not mortal, let him ask, and He will give him. What will He give? Eternal life. To whom? To those sinning not unto... death. In general, he divides sin thus: all unrighteousness is sin, and one sin is unto death, another is not unto death. But concerning the sin unto death he says: let him not ask, that is, let him not pray, for he will not be heard, because he asks not for what is good. He means the one who shows no sign of repentance. For the sin unto death is precisely that in which no repentance is offered. Judas was afflicted with this sin, and was subjected to eternal death. Those who bear grudges also sin unto death, for Solomon says: "the ways of those who remember evil lead to death" (Prov. 12:28). For those who remember evil and do not cease their anger against their neighbor do not turn to repentance, but sin unforgivably.
Source: Commentary on 1 John