NOTE: Some nodes initialize on startup and won’t update port/etc. after that, so code like yours above would never switch ports. This is probably rare and is not the case with the joystick node (but you have to drill down to the C++ code in analog-read to know that for sure).
Changing to an “invalid” port isn’t going to keep data from being read. It is just going to read the data from a different port. If that port isn’t connected to anything, the value is going to float. Internal circuits might drain or charge the port; any static electricity might affect it, etc. and it can change dramatically between each read (or it might stay the same value—there is no way to know and it might work differently the next time you use it).
I think in XOD, the closest you can come to “no value” is to stop changing the value. That can be done as cesars showed above by only telling the joystick to update when it is active (the node you are using just assumes it should always update; the -all node exposes the update pins so you can control that). It can also be done by using gate or buffer nodes on the output. There are probably other options as well, but these are the most “conventional” methods in XOD. Which option is “better” might depend on your other code. If there was no option to use the UPD pins, then it obviously would not be the “right” answer. Other code might already be solving most of the problem for you using one solution, but not the other. In general, if not allowing update (like cesars’ solution) is an option, it is probably the better solution than adding gate or buffer nodes to the output; it generally means the Arduino will have less work to do since some of the code (in this case what is in the joystick node) doesn’t have to execute if UPD pin doesn’t pulse.