Plans to extend and transform an Edinburgh office block into 65 residential apartments have been rejected by the council.