The codes have changed on this in the fairly recent past.
In 2000, International Reseditial Code (IRC) had this section.
R702.4.2 Gypsum backer. Gypsum board utilized as the base or backer board for adhesive application of ceramic tile or other
nonabsorbent finish material shall conform with ASTM C 630 or C 1178.
Water–resistant gypsum backing board shall be permitted to be used on
ceilings where framing spacing does not exceed 12 inches (305 mm) on
center for ½ inch thick (12.7 mm) or 16 inches (406 mm) for
5/8–inch–thick (15.9 mm) gypsum board. All cut or exposed edges,
including those at wall intersections, shall be sealed as recommended
by the manufacturer.
In 2003 the IRC added this section.
R702.4.3 Limitations. Water-resistant gypsum backing board shall not be used in the following locations:
1. Over a vapor retarder in a shower or bathtub compartment.
2. Where there will be direct exposure to water, or in areas subject to continuous high humidity.
In 2006, section 702.4.2 was changed and 702.4.3 was removed.
R702.4.2 Fiber-cement, fiber-mat reinforced cement, glass mat gypsum backers and fiber-reinforced gypsum backers. Fiber-cement, fiber-mat
reinforced cement, glass mat gypsum backers or fiber-reinforced gypsum
backers in compliance with ASTM C 1288, C 1325, C 1178 or C 1278,
respectively, and installed in accordance with manufacturers'
recommendations shall be used as backers for wall tile in tub and
shower areas and wall panels in shower areas.
So what does all this mean?
It means "Greenboard" can still be used in bathrooms (and other areas), it just cannot be used as a backer for tile in a shower or tub surround. It can be used in areas not subject to direct water exposure (tub/shower surround), and areas of noncontinuous high humidity (bathrooms).
So, can you use "Greenboard"? Probably. It was done that way from the time "Greenboard" was introduced, until IRC 2003 was adopted.
Should you use "Greenboard"? Probably not (unless that is the only option available to you). Even if your area does not follow International Residential Codes, the IRC can be used as a fairly good set of best practices.