Based on my reading of the period and Prussian politics... Territorial integrity was a key priority for the majority of Prussia's elite, in particular connecting Westphalia to the traditional Prussian holdings. Of course some people, primarily juinkers east of the Elbe, didn't care but most Prussians knew that for Prussia to be the leading German state they'd need to make sure that they weren't depending on other states to get access to their western possessions.
Now how much territory Prussia needs, that can vary based on the individual players. In 1866 not everyone wanted to annex all of Hannover, instead merely annexing the portions of the kingdom that were south of the Duchy of Brunswick, which at the time was also lacking an heir, and arranging to inherit the Duchy of Brunswick, while allowing the Hannoverian throne to be passed to Ernest August, the Duke of Cumberland.
Annexing Hesse-Cassel was mere opportunism, since the state originally intended to be neutral but joined the Austrian side after Prussia requested them to violate their neutrality by allowing the passage of Prussian troops through its territory. So avoiding that should be easy. That'd limit the annexations to Nassau, Frankfurt, Schleswig-Holstein, and portions of Hesse-Darmstadt (and the bits of Hannover described above). And most of those could probably be avoided, too, however it's less likely than negating the annexation of all of Hannover.