Assuming that you are talking about using a standard cardboard bike box, the standard way to protect the rear derailleur is to have the derailleur shifted up to the largest cog. As a bike store owner for over 12 years, I have seen thousands of geared bikes, and that is the way that they always come. (I've never seen one damaged).