It is actually possible to use Sneak to escape the prison of Fort Joy completely undetected. However, if you return, any of the guards you see will now attack you on sight. It doesn't matter if you're still wearing your collar.
This is because they have psychic knowledge that you had left the prison. Even though the fort, the docks, the jail cells, Flenserville, and other areas are off-limits and would normally lead to guards arresting you, they do not use their psychic knowledge to do anything about this unless you step outside the prison bounds.
This is actually apparently completely intended by the developers.
I honestly do not understand what the point of setting that flag is.
The game is okay with you sneaking out undetected. It's okay with letting you walk around in front of guards armed to the teeth (as long as you haven't left the prison grounds). It's okay with letting you fight the mayor of Flenserville and leaving through the sewer. It's okay with letting you start a fight and murdering the toughest gang in prison. It's okay with letting you kill all the prisoners. It's okay with letting you kill all the guards.
So I don't see the problem with letting the players come and go from the Hollow Marshes to the prison which is solved by having the guards psychically know that despite you being in the prison at this moment wearing your collar, you are actually an escaped criminal who... came back.
I just genuinely don't see any useful purpose the psychic guards serve.