Plans to house young offenders just meters from residential homes and a school have been rejected by the government.