When we approach God we have to come on His terms or He will not hear us. The issue of sin must be dealt with prerequisite to God hearing anything else from us. However, due to the influence of Free Grace Theology, many are deceived on this point thinking that as Christ took away the barrier of sin thus God will listen to them regardless of whether they continue to live a lifestyle of sin or not. But while the freedom we have in Christ is a freedom from eternal condemnation, it is also freedom from the power of sin so that we may live a holy life.
For to the Christians it is written, "For of this you can be sure: No immoral, impure or greedy person— such a man is an idolater— has any inheritance in the kingdom of Christ and of God. Let no one deceive you with empty words, for because of such things God’s wrath comes on those who are disobedient." Eph 5:5,6 And so also "Do not be deceived: Neither the sexually immoral nor idolaters nor adulterers nor male prostitutes nor homosexual offenders nor thieves nor the greedy nor drunkards nor slanderers nor swindlers will inherit the kingdom of God. And that is what some of you were But you were washed, you were sanctified, you were justified in the name of the Lord Jesus Christ and by the Spirit of our God." 1Cor 6:9-11 Those who have been born of God no longer live a lifestyle of sin for, "No one who is born of God will continue to sin, because God’s seed remains in him; he cannot go on sinning, because he has been born of God. This is how we know who the children of God are and who the children of the devil are: Anyone who does not do what is right is not a child of God; nor is anyone who does not love his brother." 1John 3:9,10
Though they used to be sinners, those who have been born of God are no longer sinners in the sense spoken of in these verses. Rather as the blind man said - they are godly men who do His will. For Jesus also said, "Not everyone who says to me, ‘Lord, Lord,’ will enter the kingdom of heaven, but only he who does the will of my Father who is in heaven." Mat 7:21
Thus if you want God to listen to your prayers and act upon them, then as Jesus said to the adulterous woman, "Go an sin no more." John 8:11 This includes relational issues. For Peter writes, "Husbands, in the same way be considerate as you live with your wives, and treat them with respect as the weaker partner and as heirs with you of the gracious gift of life, so that nothing will hinder your prayers." 1Peter 3:7 And it includes hidden sins of the heart, for David writes, "If I had cherished sin in my heart, the Lord would not have listened." Ps 66:18
However one more thing to note is that if you are godly and therefore God listens to you, God will listen to you concerning everything. If you are a friend of a sinner who asks for prayer concerning something unrelated to their repenting of sin, like some problem or circumstance they have to face, even though God does not listen to them, God will listen to you. For Jesus often did a miracle - like healed sinners - and then dealt with the issue of sin. And God's answering your prayers concerning them, that will affirm your message in their eyes. Therefore "I urge, then, first of all, that requests, prayers, intercession and thanksgiving be made for everyone— for kings and all those in authority, that we may live peaceful and quiet lives in all godliness and holiness. This is good, and pleases God our Savior, who wants all men to be saved and to come to a knowledge of the truth." 1Tim 2:1-4