A south Wales NHS trust's proposal to develop a community health and drug rehabilitation unit has been denied planning permission after an inspector decided that it would have undesirable repercussions for the use of an adjoining area of open space.