Someone asked this very question on this forum a while back. The Catechism of Trent expounds very well on this very issue.
The Highest Degree Of Prayer: The Prayer Of The Just
What, then, is the best manner and the most exalted degree of prayer? It is that which is made use of by the pious and the just. Resting on the solid foundation of the true faith, they rise successively from one degree of prayer and virtue to another, until, at length, they reach that height of perfection, whence they can contemplate the infinite power, goodness, and wisdom of God; where, too, they are animated with the assured hope of obtaining not only those blessings which they desire in this life, but also those unutterable rewards which God has pledged Himself to grant to him who piously and religiously implores His assistance.
Soaring, as it were, to heaven, on these two wings, the soul approaches, in fervent desire, the Divinity; adores with supreme praise and thanksgiving Him from whom she has received such inestimable blessings; and, like an only child, animated with singular piety and profound veneration, trustfully tells her most beloved Father all her wants.
This sort of prayer the Sacred Scriptures express by the words pouring out. In his sight, says the Prophet, I pour out my proyer, but before him I declare my trouble. This means that he who comes to pray should conceal or omit nothing, but pour out all, flying with confidence into the bosom of God, his most loving Father. To this the Sacred Scriptures exhort us in these words: Pour out thy heart before him, cast thy care upon the Lord. This is that degree of prayer to which St. Augustine alludes when he says in that book entitled Enchiridion: What faith believes, that hope and charity implore.
The Second Degree Of Prayer: The Prayer Of Sinners
Another degree of prayer is that of those who are weighed down by the guilt of mortal sin, but who strive, with what is called dead faith, to raise themselves from their condition and to ascend to God. But, in consequence of their languid state and the extreme weakness of their faith, they cannot raise themselves from the earth. Recognising their crimes and stung with remorse of conscience, they bow themselves down with humility, and, far as they are removed from God, implore of Him with penitential sorrow, the pardon of their sins and the peace of reconciliation.
The prayers of such persons are not rejected by God, but are heard by Him. Nay, in His mercy, He generously invites such as these to have recourse to Him, saying: Come to me, all you that labour, and are heavily laden, and I will refresh you, of this class was the publican, who, though he did not dare to raise his eyes towards heaven, left the Temple, as (our Lord) declares, more justified than the Pharisee.
The Third Degree Of Prayer: The Prayer Of Unbelievers
A third degree of prayer is that which is offered by those who have not as yet been illumined with the light of faith; but who, when the divine goodness illumines in their souls the feeble natural light, are strongly moved to the desire and pursuit of truth and most earnestly pray for a knowledge of it.
If they persevere in such dispositions, God, in His mercy, will not neglect their earnest endeavours, as we see verified by the example of Cornelius the centurion. The doors of the divine mercy are closed against none who sincerely ask for mercy.
The Lowest Degree Of Prayer: The Prayer Of The Impenitent
The last degree is that of those who not only do not repent of their sins and enormities, but, adding crime to crime, dare frequently to ask pardon of God for those sins, in which they are resolved to continue. With such dispositions they would not presume to ask pardon from their fellowman.
The prayer of such sinners is not heard by God. It is recorded of Antiochus: Then this wicked man prayed to the Lord, of whom he was not to obtain mercy. Whoever lives in this deplorable condition should be vehemently exhorted to wean himself from all affection to sin, and to return to God in good earnest and from the heart.