A bit lengthy, but this, from The Westminster Confession of Faith, says it best, and provides the scriptural foundation for prayer.
Of Religious Worship and the Sabbath-day.
III. Prayer, with thanksgiving, being one special part of religious
worship,(f) is by God required of all men:(g) and that it may be accepted,
it is to be made in the name of the Son,(h) by the help of His Spirit,(i)
according to His will,(k) with understanding, reverence, humility,
fervency, faith, love, and perseverance;(l) and, if vocal, in a known
(f) Phil. 4:6.
(g) Ps. 65:2.
(h) John 14:13, 14; I Pet. 2:5.
(i) Rom. 8:26.
(k) I John 5:14.
(l) Ps. 47:7; Eccles. 5:1, 2; Heb. 12:28; Gen. 18:27; James 5:16; James
1:6, 7; Mark 11:24; Matt. 6:12, 14, 15; Col. 4:2; Eph. 6:18.
(m) I Cor. 14:14.
IV. Prayer is to be made for things lawful;(n) and for all sorts of men living, or that shall live hereafter:(o) but not for the dead,(p) nor for those of whom it may be known that they have sinned the sin unto death.(q)
(n) I John 5:14.
(o) I Tim. 2:1, 2; John 17:20; II Sam. 7:29; Ruth 4:12.
(p) II Sam. 12:21, 22, 23 with Luke 16:25, 26; Rev. 14:13.
(q) I John 5:16.