David Bowie only became aware his cancer was terminal three months before his passing last January.
The revelation comes from a new documentary, David Bowie: The Last Five Years, which airs in the UK this weekend to mark what would have been the music pioneer's 70th birthday on January 8.
Bowie died on January 11 last year; his just-released album Blackstar topped charts around the world posthumously the next week.
Fans have figured Bowie knew he was dying and curated the album as his final statement, citing a series of lyrics that touch on mortality. However Johan Renck, who directed the video for single Lazarus, said fans thinking the imagery of Bowie on his death bed was a farewell gesture are wrong.
Talking to The Guardian in the UK, Renck said the concept for the video came a week before Bowie was told by doctors his illness was terminal.
"David said: 'I just want to make it a simple performance video'," Renck said of the video, where Bowie sings "Look up here, I'm in heaven" from his sick bed.
"I immediately said 'the song is called Lazarus, you should be in the bed'," says Renck. "To me it had to do with the biblical aspect of it - it had nothing to do with him being ill.
"I found out later that, the week we were shooting, it was when he was told it was over, they were ending treatments and that his illness had won."
Ivo Van Hove, who directed Bowie's musical Lazarus, said the singer was still hoping he could survive cancer and wanted to keep working.
In the new documentary Van Hove says of Bowie attending the opening night of the musical: "He got through the night. I really am convinced that he was fighting death and he wanted to continue and continue. Afterwards we were sitting behind stage and he said 'let's start a second one now, the sequel to Lazarus'."
The documentary is the work of Francis Whately, who made David Bowie: Five Years in 2013, focusing on five key years between 1971 and 1983 in his career.
The Last Five Years follows 2013's 'surprise' comeback album The Next Day, and the making of Blackstar and Lazarus.
The ABC screened Five Years, but the network has not yet announced if they will air the new documentary.
As with the previous documentary, Bowie is not interviewed for the film but the musician gave Whatley his time and blessing.
The director told The Guardian: "I think everyone would like me to say he was turning up to the studio to record Blackstar and he was terribly ill, but I don't think he was. There are musicians in the Blackstar band who didn't even know. We all now know he was ill, we know he was undergoing treatment, but it doesn't seem to have had an effect at all on his output."