Have you fed the tank and they still haven't came out? Did you qt them? How did you acclimate them? How big is your tank?
I know it's not uncommon for new addition to hide for a while, personally I've never had a fish hide for more than a day on me. Especially a sand sifting goby, as they usually start working the sand bed immediately. The gramma is definitely more inclined to hide.
I would give it more time, since it's a new tank you should be watching your ammonia and if you see a big spike you can assume that one or both may have died. If not I would probably give it a month before I decided to purchase another of the same species.