Consider a $C^2$ bounded domain $D$ of $\mathbb{R}^d$. Let $b \subset \partial D$ a non-empty part of the boundary. Let $n(x)$ be the unit outward vector on $\partial D$.


Is there any smooth function $f \in C^\infty(\overline{D})$ such that $f=\partial\_n f=0$ on $b$.


**PS:** It was further required the following condition $f=1$ on $\partial D \setminus b$, but it seems to be impossible in this case.


If there is no direct answer, it would be more helpful to mention a reference where the existence of such a function is studied.



Existence of a special function
From your assumptions, you have a $C^2$ function $\rho:\mathbb R^d\rightarrow \mathbb R$, such that
$$
D=\{x\in \mathbb R^d, \rho(x)<0\}, \quad \partial D=\{x\in \mathbb R^d, \rho(x)=0\},
$$
and
$
x\in \partial D\Longrightarrow d\rho(x)\not=0.
$
As a result, locally the set $D$ is given by an inequality $x\_d<\phi(x')$ and the boundary by the equality $x\_d=\phi(x')$ where $\phi$ is a $C^2$ function on $\mathbb R^{d-1}$. Now the function $f$ given by
$$
f(x) =\bigl(x\_d-\phi(x')\bigr)^2
$$
satisfies your requirements, but is only $C^2$. Going back to the function $\rho$,
you can use a theorem of H.Whitney saying that given the closed set $\partial D$, you can find a $C^\infty$ function $f$ positive on the complement of $\partial D$ and vanishing on $\partial D$. Then of course $df$ must vanish on $\partial D$ since $f$ is non-negative.


