They can do so, and we have to be really aware that morphine can make you distressed and that steroids can make you more emotionally labile.
When somebody says that they feel their life isn't worth living, you need to answer that with a question as to why, what's going on and what's happening. It may be that there is some medication there that is altering their capacity. It may be the cancer itself that's altering the capacity or the other disease they have. They may have a depression.
You have to explore it and diagnose the underlying cause. Then, when you've done that, you need to deal with the underlying causes of their distress. However, if you just respond at face value, then you'll never begin to understand the person and what they really need.
The danger is forgetting that autonomy is relational. We all interact. The way the doctor behaves towards the patient alters the way the patient receives their outcome. There's good evidence from Canada that dignity is enhanced by the way that care is given or is undermined by the way it isn't given.