Yes, as long as no one sees you. The first time caught you get a warning to leave, and the second time they open fire.Can you sneak into restricted areas of settlements if nobody is looking or does crossing the warning barrier automatically trigger an alarm?
Also if you can't allow yourself to get scanned, you do have a get out of jail card. Pull out your gun, the guard will forget about scanning and tell you to stow your gun. This also only works once, after that they start shooting.
Both the trespass and the stow weapon warning shows up on your HUD.