This looks strange. I'm not sure where you found it. のに means "although" making the sentence sound like: "Although it goes well, please pray."
I think you're confused with ように indicating a goal.
Most prayers are formed like this: うまく行くように（祈る）。
This is the correct form for the transitive verb 祈る
Can also replace の with こと
1- ように indicates the goal. You pray so that things goes well.
Prayers in temples are formed like this and many people before an exam for example or before a speech will address a prayer like this. (no need to be in a temple)
The verb 祈る is sometimes omitted.
2- Vb + の/ことを祈る
This is more of an everyday hope expression, a wish for luck. (second meaning of 祈る is "to wish")
Most people will translate うまく行くことを祈りましょう
as "Let's cross our fingers"
You can also say: 成功を祈ってね -> "'pray' for my success" or "wish me success"
Or something like:
3- And thanks to istrasci for pointing out that using only に indicates to whom you address the prayer: 神様に祈る