The method depends on how your script is set up and also whether or not you're actually using IP's or if you're using the address mask, which may be a host instead of an IP.
The basic idea would be:
if (255.255.255.255 isin $address($nick,2)) { return }
else { ban code }
Note that you could also just use the User list and check for the user level and if the user has a "protected" level, don't ban. Like I said, it depends on your script and how you want to do it.