5  If any of you lacks wisdom, let him ask God, who gives generously to all without reproach, and it will be given him. 6  But let him ask in faith, with no doubting, for the one who doubts is like a wave of the sea that is driven and tossed by the wind. 7  For that person must not suppose that he will receive anything from the Lord; 8  he is a double-minded man, unstable in all his ways. James 1:5-8 (ESV)

James suggested that we ought to be careful when we pray.  After all, the God of the universe is listening.  This same God who already knows what you are going to say, also knows your heart.  He knows why you are asking, in addition He even knows whether you are even going to listen to His answer.

Paul told Timothy (1Tim 5:22), not to participate with another person too quickly because you may inadvertently be participating in their sin. 

In both cases, we must be aware as much as possible, what is really going on here.  It is possible to have incorrect motives when we pray.  It is equally possible that the people asking you to pray with them have incorrect motives.  When we join them, we are participating in their sin, regardless of what our motivation is.

In dedicating the Temple (1Chron 6), Solomon is asking God, (who has said He would meet them in the Temple and listen to them) that God would hear and forgive and answer in accordance to the ways of the one who is praying.  Because Solomon knew that God knows the hearts and intents of those who come before Him, that He was uniquely qualified to answer those prayers appropriately.

I am not suggesting that we not pray.  That would be tantamount to shooting ourselves in the foot.  Instead, I am suggesting we pray more.  The more we are in contact with God, the better we can discern the motives around us and to know what to pray and when.

And HOW.