When I went through the inquisition of my Ordination Counsel this question came up. Probably the next 45 minutes defending my answer, because I said that I didn't believe that Scripture teaches an age of accountability. I believe that this is a doctrine that has been formed out of whole cloth by pastors/ministers who copped out on their responsibility to teach from Scripture even on the more difficult topics.
One of the Pastors present asked me, "What about David's assurance that he would see his child in heaven." My response, "I don't believe that we can dogmatically teach a doctrine based on one passage of Scripture uttered by a man in the depths of emotional depression. Especially when there was NO confirmation mentioned from the Lord that David was correct.
The idea mentioned earlier was brought up about those under the age of Joshua and Caleb not being judged was proof of an age of accountability. I pointed out that there in no indication that there was anything special about their age. Paul wrote to Timothy, "let no man despise thy youth..." when Timothy was probably around 35 years old, and that considering that, those under the age of Joshua and Caleb were probably given a measure of grace because of Joshua and Caleb's faithfulness.
Then they tried the tactic of asking, "Are you saying that if you have a young couple in your church lose one of their children as a baby you're going to tell them that their child is in hell because it died before it had a chance to accept Christ?" I told them, "No! But, neither am I going to lie to them and tell them that they can be sure that their child is in heaven because of some doctrine that doesn't have Scriptural support."
Then I asked them, why do you preach and teach against abortion if you are so convinced that a baby that dies automatically goes to heaven? Wouldn't that mean that you should support abortion because it assures that more will be in heaven?
Shortly after my ordination a family in the church did lose a child 13 days after birth. When they asked if their baby was in heaven I told them that I couldn't honestly answer their question because Scripture isn't clear about that question. I told them that we know that G-d is both completely Holy and Just and that what we could be sure of is that He will do the right thing, no matter what that was.
At the graveside service, there were tears and grief over the loss. but it was subdued and controlled. A short distance from the graveside the was another young couple sitting at the side of a grave. (I should have mentioned that this area of the cemetary was exclusively for babies) During the entire graveside service this couple were placing flowers and toys on this other grave. Both were crying uncontrollably.
Later, out of curiosity I went over to the other grave to see how long it had been since they had lost their child that they were still so unconsolable. Their baby had died more than 6 years previous to their display of grief.