Plans to convert a vacant York pub into apartments have been blocked almost a decade after it closed.