Some Things We Won’t Understand

2 Samuel 12:16,17
“David pleaded with God for the boy. He fasted and went into his house and spent the night lying in sackcloth on the ground. The elders of his household stood beside him to help him up from the ground, but he was unwilling and would not eat anything with them.”

David intercedes for the boy. I understand that. I think all of us pray for our children, loved ones and family. However, Nathan told David that the child would die. This was a message from God. David still intercedes. This mystifies me. He knows the child will die, by God's word, yet he intercedes intensely. He shares his logic later in verse 22, "Who knows? The LORD may be gracious to me and let him live." I'm sure if the child was mine, I would understand. 
My thinking is that God's will in best. There have been a few instances in scripture were people pleaded with God and He did change His mind. However, it seems that God's original plan was better. 
An example of this is Hezekiah. He was a good king who brought Israel back to God. Isaiah came to him and told him to prepare for he was going to die. He pleaded with God and God gave him 15 more years to live. The problem was that in these extra years he had a son who became king who was evil and brought the nation into evil. If Hezekiah would have died when he was supposed to, his evil son wouldn't have been born. God's ways are better. 
I do admire David's effort. Emotionally it seems like a lot to do what he did for seven days, when it wasn't to be. Particularly because the child was the result of sin. Many problems could have been present for the child and David. 
God, work Your will in us. Help us to learn the correct lessons from this story.