We have had our adopted cat, Fat Louie, for about six weeks now, and his behovior is very similar to your cat's. He is very friendly and will let me touch and pet him all over his body, purring, kneading, and rubbing against my hand, as long as he is under my desk or something else where his body is not exposed. The minute he is out from under, however, he will not come near me or anyone else. When I get up in the AM, he is sometimes out in the front part of the house, but as soon as he sees me, he literally charges back to his safe space under my desk in my study. Once there, he is fine again. I think that:
1) He was probably feral and misdiagnosed by the shelter as a domestic cat, and/or
2) He was "institutionalized" for so long (in three different shelters over the course of about seven months) that he doesn't feel comfortable out of a confined space.
I gradually blocked off most of the places where Louie could hide, only leaving the ones available that would allow me to get near him. Once I did that, I was able to approach him gradually, getting a little nearer each time and never trying to force him to do anything, until he finally accepted me as someone who was not going to hurt him. Now we are "friends", as long as he's in his safe space. I don't know how long it will be before he gets over his fear, but my patience seems to be being rewarded, albeit VERY SLOWLY. I know it's frustrating, but I think the only answer to the problem is to take things slowly and be patient.
#PetBehaviorandTraining