Starship legends now has missions that lead to random star systems. It automatically won't choose systems with hidden markets (myMarket.isHidden()), but to manually prevent it from choosing a system as a mission destination, you can add the tag "sun_sl_hidden" like this:
myStarSystem.addTag("sun_sl_hidden");
The tag "hidden" also works, but I might remove that at some point if unwanted overlap ever occurs.