The Hampshire Cos. has sold a roughly 8,000-square-foot office building in Harding Township, under a newly announced transaction by NAI James E. Hanson.