Recall Poincaré inequality:
Let $\Omega$ be a bounded open set in $\mathbb{R}^n$. Then there is a $C=C(\Omega,n)>0$ such that $\|u\|_{L^2(\Omega)}\leq C\|\nabla u\|_{L^2(\Omega)}$ for all $u\in C_c^1(\Omega)$ (or $u\in H_0^1(\Omega)$).
I want to prove the following version:
Let $\Omega$ be a bounded connected open set in $\mathbb{R}^n$ with smooth boundary $\partial\Omega$. Let $\Gamma\subseteq\partial\Omega$ be a relatively open set. Then there is a $C=C(\Omega,n,\Gamma)>0$ such that $\|u\|_{L^2(\Omega)}\leq C\|\nabla u\|_{L^2(\Omega)}$ for all $u\in C^1(\bar{\Omega})$ with $u=0$ on $\Gamma$.
This can be proved by contradiction and using Rellich compactness theorem in $H^1(\Omega)$.
But I am more interested on a proof giving some idea of a possible $C$ (not necessarily the optimal one, just a $C$). Here is my attempt for a convex $\Omega$. I was not able to finish the proof. Maybe the whole idea is wrong, I do not know...
Given $z\in\Gamma$ and $\sigma\in \mathbb{S}^{n-1}$, let $g(r)=u^2(z+r\sigma)$ defined on $A_{z,\sigma}=\{r>0:\,z+r\sigma\in\Omega\}$. For all $\bar{r}\in A_{z,\sigma}$ $$ u^2(z+\bar{r}\sigma)=g(\bar{r})=\underbrace{g(0)}_{=0}+\int_0^{\bar{r}}g'(r)\,dr=2\int_0^{\bar{r}}u(z+r\sigma)\,\nabla u(z+r\sigma)\cdot\sigma\,dr.$$ Then $$u^2(z+\bar{r}\sigma)\leq 2\int_0^{\bar{r}}|u(z+r\sigma)|\,|\nabla u(z+r\sigma)|\,dr\leq 2\int_{A_{z,\sigma}}|u(z+r\sigma)|\,|\nabla u(z+r\sigma)|\,dr,$$ so \begin{align*}\int_{A_{z,\sigma}}u^2(z+r\sigma)\,dr \leq {} & 2|A_{z,\sigma}|\int_{A_{z,\sigma}}|u(z+r\sigma)|\,|\nabla u(z+r\sigma)|\,dr\\ \leq {} & 2\,\text{diam}(\Omega)\int_{A_{z,\sigma}}|u(z+r\sigma)|\,|\nabla u(z+r\sigma)|\,dr. \end{align*} Now use the well-known inequality $2ab\leq a^2/\epsilon+b^2\epsilon$ with $a=|u(z+r\sigma)|$, $b=|\nabla u(z+r\sigma)|$ and $\epsilon=2\,\text{diam}(\Omega)$, so that $$\int_{A_{z,\sigma}}u^2(z+r\sigma)\,dr\leq 4\,\text{diam}(\Omega)^2\int_{A_{z,\sigma}}|\nabla u(z+r\sigma)|^2\,dr.$$ Integrating on $\mathbb{S}^{n-1}$ with respect to $d\sigma$ and using $r^{n-1}\,dr\,d\sigma=dy$, \begin{align*}\int_\Omega u^2(y)\,\frac{1}{|y-z|^{n-1}}\,dy= {} &\int_{\mathbb{S}^{n-1}}\int_{A_{z,\sigma}}u^2(z+r\sigma)\,dr\,d\sigma \\ \leq {} & 4\,\text{diam}(\Omega)^2\int_{\mathbb{S}^{n-1}}\int_{A_{z,\sigma}}|\nabla u(z+r\sigma)|^2\,dr\,d\sigma \\= {} & 4\,\text{diam}(\Omega)^2\int_\Omega |\nabla u(y)|^2\,\frac{1}{|y-z|^{n-1}}\,dy. \end{align*} Since $|y-z|\leq \text{diam}(\Omega)$, $$\int_\Omega u^2(y)\,dy\leq 4\,\text{diam}(\Omega)^{n+1}\int_\Omega |\nabla u(y)|^2\,\frac{1}{|y-z|^{n-1}}\,dy,$$ for every $z\in\Gamma$.
My problem: I would like to get rid of $1/|y-z|^{n-1}$. I thought of integrating on $\Gamma$ with respect to $d\sigma$ at both sides, and to bound $$\int_\Gamma \frac{1}{|y-z|^{n-1}}\,d\sigma(z).$$ If this integral were a Lebesgue integral, since $n-1<n$ we would have the boundedness of the integral. But we are dealing with a surface integral. As $\Gamma$ is relatively open and $\partial\Omega$ is smooth, there is a relatively open subset $V\subseteq\Gamma$ such that $V$ is the graph of a function $\varphi:W\subseteq\mathbb{R}^{n-1}\rightarrow\mathbb{R}$, so (denote $y=(y',y_n)$): $$\int_V\frac{1}{|y-z|^{n-1}}\,d\sigma(z)=\int_W\frac{\sqrt{1+|\nabla \varphi(z')|^2}}{(|y'-z'|^2+|y_n-\varphi(z')|^2)^{\frac{n-1}{2}}}\,dz'\leq C\int_W \frac{1}{|y'-z'|^{n-1}}\,dz',$$ but this last integral may not be finite.
EDIT: Another (unsuccessful) attempt of proof is the following, with no need of using radius $r$ or angles $\sigma$. It uses the idea of an answer below to prove that Poincaré inequality holds when the hypothesis is that the mean of the function over the domain is $0$.
If $x\in\Omega$ and $z\in\Gamma$, then $$ u(x)=u(x)-u(z)=\int_0^1 \nabla u((1-t)z+tx)\,dt\cdot (x-z),$$ so $$|u(x)|\leq\text{diam}(\Omega) \int_0^1|\nabla u((1-t)z+tx)|\,dt,$$ and by Jensen's inequality $$u(x)^2\leq\text{diam}(\Omega)^2 \int_0^1|\nabla u((1-t)z+tx)|^2\,dt.$$ Integration over $\Gamma$ and $\Omega$, \begin{align*} \|u\|_{L^2(\Omega)}\leq {} & \frac{\text{diam}(\Omega)^2}{|\Gamma|}\int_{\Omega}\int_\Gamma\int_0^1 |\nabla u((1-t)z+tx)|^2\,dt\,d\sigma(z)\,dx \\ = {} & \frac{\text{diam}(\Omega)^2}{|\Gamma|}\bigg[\underbrace{\int_\Gamma\int_{1/2}^1\int_\Omega |\nabla u((1-t)z+tx)|^2\,dx\,dt\,d\sigma(z)}_{(I)} + \\ + {} & \underbrace{\int_\Omega\int_{0}^{1/2}\int_\Gamma |\nabla u((1-t)z+tx)|^2\,d\sigma(z)\,dt\,dx}_{(II)}\bigg].\end{align*} For (I), make the change $(1-t)z+tx=y$, $dx=dy/t^n$, so that $$(I)=|\Gamma|\left(\int_{1/2}^1 \frac{1}{t^n}\,dy\right)\|\nabla u\|_{L^2(\Omega)}^2\leq |\Gamma|2^n \|\nabla u\|_{L^2(\Omega)}^2.$$ For (II) one could try to do a similar thing, but I do not know how to make the change of variable in $\Gamma$.