A ballast tank is a special compartment aboard a ship (usually a seagoing ship, but not always) which contains water for use as ballast. Webster1913 talks at that writeup about "specially constructed compartments in a ship's hold" which, of course, is completely true. However, the most interesting use of the ballast tank is aboard submarines - and in that case, the tank is definitely not 'within the hold.'
Submarines use ballast tanks to adjust their level of buoyancy. Typically, the submarine will be trimmed to either neutral or slightly positive buoyancy by taking water into its ballast tanks. Then it will use its dive planes to maintain its depth. The ballast tanks can also be filled or emptied in order to raise or lower the submarine while it is stationary, and they can also be used in emergencies to surface the submarine.
Since the invention of the double-hulled submarine (see pressure hull) it has been standard practice to place the ballast tanks between the two hulls so as to make operation simpler and conserve space inside the pressurized area.
Airships also sometimes contain ballast tanks for the same purpose - to change their buoyancy. Such tanks, however, may contain dispensable ballast such as water or they might contain pressurized gas. The latter can be released into a larger space such as a lift cell or ballonet within the airship to increase lift; if pumped back into the tank under pressure, its increased density will lower lift.