Optimal filtering for degenerate nonlinear diffusions