Well for "Mothballed" ships, Space is actually quite rough on stuff, mainly from just radiations, solar wind,cosmic rays, etc. Stuff breaks down. So if your going to mothball a spaceship, lets keep on Star Trek, it would need to be Far away from a star, so past the Asteroid belt, maybe in the Kuiper belt, but then you have to deal with Cold if the systems are shut down, not just burrr its cold, I'm talking about past -100 degrees, close to absolute zero. and thats throughout the whole ship.
Systems aren't designed to take that, and if they do get that cold, they won't work if you want to warm it up and use the ship.
So a spaceship would have to be located in a safe space, maybe enclosed in some kind of dock, or asteroid,planetoid. and then some way to keep the ship above freezing, maybe some auxiliary generator to "Keep the lights on"
Now if its going to be scrapped, thats different.