Yes, you can. Opinion about this is mixed but at least I consider this as correct (if I guess correctly what the situation is). Your opponent can still get out by putting his own trapped player out of bounds (then you are forced to make a hole for him to exit).
Yes, it is valid. The matter here is that you cannot enclose the ball in such a way that is not accessible to none of their players (without having to enter out-of-bounds).
So, in your situation, it is indeed accessible to one of the yellow players. But, as Antony points out, the yellow player get out of the trap, then your only valid moves will be those that open the enclosed area.