Water likes to take the path of least resistance.
In this scenario, you have 2 paths for the water to take when it reaches your T-junction.
If we compare the two paths, we can see why it doesn't want to travel through the vertical tube. First, to go through the vertical tube it would need to overcome gravity. The tube seems thinner, so it would also have greater frictional losses as it travels through it. To add to that, it has a bend, which is another source of friction loss compared to a straight pipe.
If you're familiar with basic DC electric circuits, you may know that if you have current travelling through parallel resistors, the higher current will flow through the lower resistance branch. This is an analogous situation. The current is like the flow rate, the resistance is like the frictional and gravity losses, and the voltage is like the pressure.
You can use the equations of Bernoulli's Principle to get some idea on how these losses will effect the flowrate.
If you want to prevent water flow vertically when the tube is blocked, you need to make sure the pressure losses in the vertical tube due to gravity and friction are greater than the maximum pressure you can build up. This will depend on how you are getting your flow, if it's a pump, the pump may stall or throttle itself once it reaches max operating pressure. If it's flowing from a higher point, the safe thing to do would be to make sure your tube is higher than the high-point you feed in from. (you can probably get away with slightly below the high point due to friction losses on the way there, especially depending on how long the pipes are).