Janitor closets or any closet for that fact are the worst place to install panels primarily for the clearance issues. Closets are places to "stuff, store, hide, stash" and there is no means of oranization to those four words. I have removed ladders, paint buckets, lighting fixtures and lamps, clothing, stored food, mops buckets, and many un-mentionables to get at electrical panels and/or fire alarm panels in older buildings. The clearance is required for "worker safety". If an individual working the panel happens to recieve a shock causing their muscles to tighten and latch on to the panel or equipment sustaining the shock, the idea is the dead weight of the person will allow them to fall away from the panel into the "clearance area" breaking the bond between the person and the shock source. If they don't have the 3 foot minimum clearance and are working in a thoroughly crammmed space, they may latch on and remain in that state till help arrives, their heart gives out or an act of God occurs. That is one of the primary reasons for the 3 foot clearance rule. This has probably happened to several people and was a reason for setting clearance standards in the NEC. Just my two cents from classes and seminars. As for the original question, if that was the only place to locate the panel and water fountain I see no problem per the NEC. Personally, I would design to allow as much space as possible between the two units then "Get Er Dun".