We can and must pray for all those whom we can, because God wills all men to be saved, Jesus Our Lord died for all, and Mary Our Blessed Mother prayed for all in the course of Her life on Earth, even weeping Tears of Blood for them, as we learn from Ven. Mary of Agreda's Mystical City of God. That all souls will not be saved is not because God is unwilling but because men do not pray for it and desire it, nor work for it.
The value and efficacy of our prayers depends on our relative merits, and the charity with which we offer them. It is very difficult to obtain much for others, if we are not holy, or if we do not pray for them with great love, even with willingness to suffer in accordance with God's will.
If we offer any humble prayer to God for sinners, especially through the hands of Our Lady, we can be assured She will put them to best use, and it will certainly never be "wasted". Moreover, God who takes whatever is done for others as done to Himself will repay us a thousandfold.
Jesus said, "In offering My wounds for the conversion of sinners, even though the sinners are not converted, you will have the same merit before God as if they were"
In Fatima, Our Lady said, "Pray, pray very much, and make sacrifices for sinners; for many souls go to hell, because there are none to sacrifice themselves and pray for them ... Are you willing to offer yourselves to God and bear all the sufferings He wills to send you, as an act of reparation for the conversion of sinners? Then you are going to have much to suffer, but the grace of God will be your comfort ... You have seen hell where the souls of poor sinners go. To save them, God wishes to establish in the world devotion to my Immaculate Heart. If what I say to you is done, many souls will be saved and there will be peace."