For standard spray heads in unobstructed construction, 1"-12" measured from deflector to deck. The length of the nipple (sprig), if any, depends where your branchline is in relation to the ceiling. If you have to run it low to clear beams, the length of the sprig is the distance from the outlet fitting to put the deflector between 1 and 12 inches from the deck.
For obstructed construction, see NFPA 13 2010 8.6.4.1.2. Basically, the sprinkler can be installed from 1 to 6 inches below the structural members, up to a maximum of 22 inches from the roof deck.