For a simple, really concrete example you can also look at: $A=k[X,Y,U,V]/(XY+UX^2+VY^2)$, $X =Spec(A)$, $I=(X,Y)$, $U = D(I)$. Then the functions $f=-V/X=(Y+UX)/Y^2$ and $g=-U/Y=(X+VY)/X^2$ are defined on $U$. But $Yf+Xg=1$, so $U$ is affine! Cheers,