How to stop windows from moving past the edge of a workspace?

This is currently a defect in Unity/Compiz. The best you can do is to enable edge stickiness. In ccsm (not installed by default because it's unstable as all get out), go to Window Management and enable "Snapping windows".

Make sure all 4 check boxes are checked and set resistance to 60 and attraction to 20.

This should help you keep your windows on a workstation.

However this is one of those taste things. Some people want things to span like this, others hate it. I personally am in the hate it group. I hope I am wrong, and that someone has a magic answer, but this is the best I have been able to find.

Just to make it clear, this won't stop the behavior, but it will make it a bit easier to manage.