The general rule is that one cannot go outside (an eruv) on Shabas with something unless it is a garment or "adornment" ("תכשיט", like jewelry), or part of a garment or adornment. There are many details; see e.g. Shulchan Aruch, OC 301 and 303, and consult your rabbi with any specific questions.
Among the things permitted, however, is a certain object which is carried around as protection against miscarrying. This is permitted even for a woman who is not yet currently pregnant. (SA 303:24. Again, consult your rabbi for practical guidance.) We see here that, at least sometimes, something may be taken outside even though it is not worn at all but carried.
Mishna B'rura 301:84 notes included in the prohibition is that one may not go outside with a handkerchief in his pocket ("…בזמנינו שאין דרך להיות הפאציילע״ט תפור בהבגד לא בטיל הוא לגבי בגד ואסור…"). The reasoning is that it is not a garment or adornment, but functional.
What about a handkerchief that is adornment? Suppose people keep handkerchiefs in their suit pockets purely for adornment and would never dream of using them for anything. Could they then walk outside with such handkerchiefs on Shabas?