I think introducing her to the concept of death in a gentle way would be a good start. There are childrens’ books designed for this (to help young children cope with grief). When you talk about death, compare it to falling asleep etc.
I think it’s important to be honest because she will feel pain when you are gone. You cannot protect her from that part. By explaining to her that you are sick and there is nothing anyone can do, she will see that you aren’t leaving her on purpose. If she wakes up one day and you are gone, she might feel abandoned etc. Fill your last days with her with love and reassurance, and help her understand that you don’t want to leave her. Write a letter, something tangible that she can hold onto when she grows older. She will never forget you, and understand her father loved her.