The Thieves’ Guild is an anachronistic concept imposed on a medieval setting by some fantasy writer back in the days of yore. Fantasy fiction is prone to modernism, probably because modern readers can’t accept characters who don’t have modern knowledge and sensibilities. That’s why you’ll rarely see healers who don’t know about washing their hands or using moldy bread to break a fever. And from a modern sensibility, it would seem only natural that a criminal underworld would be highly organized.
Obviously, there was never a Thieves’ Guild, as such. The Mafia is the closest analog in terms of organization, though the character types in your typical RPG/Fantasy Thieves’ Guild are drawn from Charles Dickens.
There has probably been some sort of underworld in every culture ever since civilization arose. In many ways, it’s practical for thieves to associate with eachother, and not with squares. But these associations were probably quite loose. Although in the middle ages, craftsmen formed guilds which allowed them to set prices and gain influence, there is no evidence that such a thing ever occured among criminals before the 19th century. Some loose organization would have naturally risen around fences, recievers or panderers.
As to how open a criminal organization could be, that will vary according to time and place. One thing to keep in mind is that the institution of professional, organized policing that we’re used to is only about 150 years old. England, especially, was late in developing a police force. Under the frankpledge system inherited from the Anglo-Saxons, citizens were bound by pledge of honor to pursue and punish criminals. Even after the establishment of a constabulary, which was an unpaid position primarily responsible for overseeing watching the city gates and lighting lanterns, investigation and enforcement was largely the onus of the victim. In the late 17th century, England passed laws that legalized professional enforcement by private individuals who were empowered to collect money for capturing thieves and returning stolen goods. But these `theif-takers’ quickly learned to maximize their profits by working with thieves. This is perhaps where the closest paralell to a fantasy Thieves’ Guild arises, with thief-takers like Johnathan Wild, who in the space of seven years managed to keep the underworld of London in his thrall by organizing robberies, for which he would be rewarded when he recovered the stolen goods, and arranged for thieves who would not co-operate with him to be sent to the gallows. It’s not as though no one knew what was going on, but the law as it stood allowed him to operate with his hands clean (until he was caught and hanged, that is). But Wild changed the way crime was done, and those who came after him were more careful, and so was the state.
I don’t think it’s a coincidence that professional policing arose just behind organized crime. But it was too late to stop the Camorrah from rising to power in Sicily. They were a secret organization, but their existence, their activities and their membership was pretty well known – not unlike a Thieves’ Guild in a roleplaying game. And the same is true today of the organization that has become the Mafia – we know who they are, what they’re doing and how, but we can’t quite get rid of them. If a modern professional police force can’t wipe out the mob, what chance has a medieval one got?