I doubt even a small gun would be missed by an American cop, let alone a Gestapo agent, but it does happen. One of the first women employed by the Washington Metropolitan Police was killed when a man she had already searched pulled a gun and shot her. The reports indicated that she was too shy to really search his "privates" and that was where he had the gun hidden.
Of course, Bond was fiction and in spite of a lot of hype and "hints", Ian Fleming's "career" in intelligence seems to have been mainly desk work.
A real British spy in Nazi Germany told how, while walking down a street, he was accosted by a cop and pushed into an alley. Thinking he was done for, he found only a couple of German women set up at a table, collecting for the Winterhilf. He went limp with relief and gave them RM50, for which he was profusely thanked. He said it didn't really matter to him, as the money was counterfeit.