Yes. Take $Y=\mathbb{A}^2(k), P=(0,0)$ for example. Then $K(Y)$ is $k(x,y),$ the field of rational functions in two variables. $\mathcal{O}_P$ is the subring of $K(Y)$ which consists of rational functions defined at P. And $\mathcal{O}(Y)$ is the subring of $K(Y)$ which consists of rational functions defined at every point in $Y.$
So $\dfrac{1}{xy}$ is in $K(Y)$ but not in $\mathcal{O}_P$ since it is not defined at the origin. And $\dfrac{1}{x-1}$ is in $\mathcal{O}_P,$ but not in $\mathcal{O}(Y)$ since it is not defined everywhere in $Y$ - it is not defined at $(1,0)$ for instance. One can show (using the Nullstellensatz) that in this case, $\mathcal{O}(Y)=k[x,y]$ i.e. that the only rational functions in two variables defined everywhere on the affine plane are the polynomials.