Quick Answer
Yes, in most cases you can bid even if the solicitation's NAICS code isn't listed in your SAM registration. What matters is whether your business meets that code's size standard, and contracting officers often check your size in SAM. Before bidding on a set-aside, confirm you're small under the solicitation's code. Then add the code in SAM, or state your size in your offer if the solicitation allows it.