Catechism of the Catholic Church:
2282 …Grave psychological disturbances, anguish, or grave fear of hardship, suffering, or torture can diminish the responsibility of the one committing suicide.
2283 We should not despair of the eternal salvation of persons who have taken their own lives. By ways known to him alone, God can provide the opportunity for salutary repentance. The Church prays for persons who have taken their own lives.
A mortal sin requires 3 things: 1. grave matter, 2. knowing that it is grave matter, and 3. freely choosing the grave action.
Most people who commit suicide do not possess requirement number 3, their psychological state so impacts their ability to choose that their choose is not truly free.
As with every sin, though we may know its objective gravity, we can never really know the subjective culpability of the person. We cannot see into their mind or heart to truly know what they knew and what they were able to choose. Nor do we know if they repented in their final moments in this world.
Because of all of these “unknowables”, we always pray for the dead. However, should a person be in hell then there are indeed no prayers that can be of aid to them. Our final judgment is not different from our particular judgment.