They are not wasted. Those in heaven don't need our prayers, and those in hell are unable to profit by them. Only those who are undergoing purification prior to entering full union with God in heaven (1 Cor 3:12-15) can avail themselves of our prayers. When we pray for them we are asking God to mitigate their suffering. If the persons we pray for are not in purgatory and have already gone on to heaven, the Lord will apply our prayers to others in need of them.