Creating an unsafe zone

Im using the UR10 and looking to great an unsafe zone - a box in which the end effector cant cross.

I’m essentially trying to program in a n anti collision measure with the end effector