That's one of those mystery questions that cannot be answered with a general answer but has to be looked at from the point of view that God has a unique plan for each person's life.
On the one hand you have verses like these...
1 John 5:14 Now this is the confidence that we have in Him, that if we ask anything according to His will, He hears us. 15 And if we know that He hears us, whatever we ask, we know that we have the petitions that we have asked of Him.
...that remind us that God answers prayers with a "yes" that fit in with His plans. On the other hand you have verses like these...
Psalms 106:21 They forgot God their Savior, Who had done great things in Egypt, 22 Wondrous works in the land of Ham, Awesome things by the Red Sea. 23 Therefore He said that He would destroy them, Had not Moses His chosen one stood before Him in the breach, To turn away His wrath, lest He destroy them.
James 5:14 Is anyone among you sick? Let him call for the elders of the church, and let them pray over him, anointing him with oil in the name of the Lord. 15 And the prayer of faith will save the sick, and the Lord will raise him up. And if he has committed sins, he will be forgiven. 16 Confess your trespasses to one another, and pray for one another, that you may be healed. The effective, fervent prayer of a righteous man avails much. 17 Elijah was a man with a nature like ours, and he prayed earnestly that it would not rain; and it did not rain on the land for three years and six months. 18 And he prayed again, and the heaven gave rain, and the earth produced its fruit. 19 Brethren, if anyone among you wanders from the truth, and someone turns him back, 20 let him know that he who turns a sinner from the error of his way will save a soul from death and cover a multitude of sins.
So the bottom line is that God hears prayers, has a response to them that are according to His overall will, and that it is better to pray for sick people than it is to lack faith in the goodness of God and His ability and willingness to hear prayers that He can work together for good in His overall plan for people here on earth.