What are the conditions for a game over?
Battle processing has an "If lose" Branch.
Also if you're changing the party's HP there is a checkbox that prevents them from getting the K.O. status.
If you're wanting to show the gameover screen and then go the the prison; Fake it and use "show picture" with change the bgm. It's A gameover screen but not THE gameover screen. You might want to set that up as a common event if its a regular thing. So you'd be calling the gameover event instead of the gameover screen.
And if you want to get really technical you can change the script Scene_Gameover, under the Frame update is where it goes to the title when C is pressed.