A hospital trust has admitted to failings in a man’s end-of-life care after he was denied his final wish to spend his last moments in a hospice.