In The Catcher in the Rye, Holden Caufield can't bring himself to have sex with Sunny because he imagines her going into a store and buying a green dress without anyone realizing she's a prostitute. In this way, Holden sees her as a human, with emotional depth, instead of an object for pleasure.
Sunny's dress is green because she should symbolize youth, spring, fertility, inexperience. Because she's a prostitute, she doesn't, but Holden (green himself) sees her in this way.
Young soldiers are considered green (untested) until they've experienced combat. In the same way, Holden is considered sexually inexperienced. He has yet to cross this threshold into manhood.
Sunny's a kid, like Holden. Holden has problems communicating with girls his own age and older. He feels he has to lie to them in order for them to like him. It is only with girls younger than him, like Phoebe and Jane (when she was younger), that he understands. Why? Because they're green--uncorrupted.
So, her dress is green because he wants her to be green--a virgin. He wants to talk to her instead of have sex. He is in denial of who she really is. Maybe her dress was red or black, symbolic of lust and death, but Holden sees her through rose-colored glasses and chooses green instead. Just as he idealizes the younger Jane and is denial of the sexually active Jane who dates Stradlater, Holden wants Sunny to be like his sister Phoebe instead of the girls in the Lavender room and the hotel.