Sure; I was generalizing; my mother never taught us that stealing or killing or even polluting was fine if we would not get caught!
However I don't think I agree with your way of thinking. The reason we have laws is because people will not naturally do the right thing; otherwise laws and police would be entirely unnecessary, no?
There are tons of stuff every day I could steal, knowing that any law I might break would not be enforceable simply because no one knew it was me. Littering in the forest. Dumping toxic materials into rivers.
All that works because most people don't do it, only a few.