Praying in a place where prayer is not permitted

And whoever sees that he prays in a place where it is not permissible to pray, then it is corrupt in his religion, and it was said whoever saw that he missed the prayer with the imam, then it is equivalent to that, and if he catches the last prayer and then completes it on his own, there is nothing wrong with that .