Altium: how to assign a net class to unconnected pins?
Short answer: You can't assign a net class to something that has no net. 

But, there are potentially some workarounds; unfortunately, none of them are perfect. 


Add an additional rule that looks for non-connected pads and give them additional spacing, using the custom query  ((Not InAnyNet) And IsPad)1.

In addition to this, you could make the first object more specific, such as to a particular net. The downside to this approach is that it will add the additional spacing to ALL the unconnected pads in your board. Is that a big deal? Up to you.





As others mentioned (and I think yourself), you could add an arbitrary net to each unconnected pin on connectors you are interested in. In addition, to be a little more elegant, and to catch mistakes, you could add a DRC check that gives you a warning whenever a pin is unconnected - and then for pins you are actually not interested in adding a net or an arbitrary net to, you can place the DRC error nullifier (the red 'X') on those pins.

In this photo you can see that my connector J24 has unconnected pins 1, 2, 6 and 7.  Pad 2 has a non-specific DRC no error marker on it (Red 'X'). See how warnings are thrown for Pins 1, 6 and 7, but now pin 2? The matrix in the photo is found under Project/Project Options/Connection Matrix.