I hope I'm using the terminology correctly. What I mean is this: fix $K = \mathbb{R}$ or $\mathbb{C}$ (I'm interested in both cases). Which topological spaces $X$ have the property that for every open set $U$, every continuous function $f : U \to K$ is a quotient of continuous functions $\frac{g}{h}$ where $g, h : X \to K$ and $h \neq 0$ on $U$?

This isn't a complete answer, but I think that whatever the family is, it contains compact metric (metrisable) spaces. With a paracompactness argument, I suspect that it would extend to locally compact, and I would not be surprised if one could replace "metrisable" by something weaker (though I think that it would need that separation property oneabovenormal which I can never remember the name of: namely that every closed set is the zero set of a continuous function). Here's a proof (I hope): Let $M$ be a compact metric space, $U \subseteq M$ an open subset, $f : U \to \mathbb{R}$ a continuous function. Let's write $K$ for the complement of $U$ in $M$. For each $n \in \mathbb{N}$, let $C_n \subseteq U$ be the subset consisting of points at least distance $1/n$ away from $K$. Then $C_n$ is closed in $M$, hence compact, and $\bigcup C_n = U$. Let $h_0 : M \to \mathbb{R}$ be the "distance from $K$" function (so that $C_n = h_0^{1}([1/n,\infty))$). Let $V_n$ be the complement of $C_n$. As $C_n$ is compact, $f$ is bounded on $C_n$. Let $a_n = \max\{f(x) : x \in C_n\}$, then $(a_n)$ is an increasing sequence. Let $(b_n)$ be a decreasing sequence that goes to $0$ faster than $(a_n)$ increases, specifically that $(a_nb_n) \to 0$. Let $r : [0,\infty) \to [0,\infty)$ be a continuous decreasing function such that $r(1/n) = b_{n+1}$ (as $(b_n) \to 0$ (this always exists) and let $h = r \circ h_0$. Then for $x \in V_{n1}$, $h_0(x) \lt 1/(n1)$ so $h(x) \lt b_n$. Then $h : M \to \mathbb{R}$ is a continuous function. Moreover, $h f$ (the product, with $h$ restricted to $U$) has the property that for $x \in C_n \setminus C_{n1} = V_{n1} \setminus V_n$, $$ (f h)(x) = f(x) h(x) \le a_n b_n $$ Thus as $x \to K$, $(f h)(x) \to 0$ and so we can extend $f h$ to a continuous function $g : M \to \mathbb{R}$ by defining it to be $0$ on $K$. Then on $U$, $f = g/h$. (I made this up, so obviously, there may be something I've overlooked in this so please tell me if I'm not correct.) Edit: This one's been bugging me all weekend. I've even gone so far as to look up perfectly normal. This property holds for perfectly normal spaces. In a perfectly normal space, every closed set is the zero set of a function (to $\mathbb{R}$, and this characterises perfectly normal spaces according to Wikipedia). Here's the proof. Let $X$ be a perfectly normal space. Let $U \subseteq X$ be an open set, and $f : U \to \mathbb{R}$ a continuous function. Let $r : X \to \mathbb{R}$ be such that the zero set of $r$ is the complement of $U$. Let $s : \mathbb{R} \to \mathbb{R}$ be the function $s(t) = \min\lbrace 1, t^{1}\rbrace$. The crucial fact is that if $p : U \to \mathbb{R}$ is a bounded function then the pointwise product $r \cdot p : U \to \mathbb{R}$ (technically, $p$ should be restricted to $U$ here) extends to a continuous function on $X$ by defining it to be zero on $X \setminus U$. From this, the rest follows easily.
This isn't a complete characterisation of these spaces. Essentially, this result holds if there are enough continuous functions (as above) on $X$ and if there are too few. As an example of the latter, consider a topological space $X$ where every pair of nontrivial open sets has nonempty intersection. Then there can be no nonconstant functions to $\mathbb{R}$, either on $X$ or on any open subset thereof. Hence every continuous function on an open subset of $X$ trivially extends to the whole of $X$. However, there's probably some argument that says that once you have sufficient continuous functions (say, if the space is functionally Hausdorff  i.e. continuous functions to $\mathbb{R}$ separate points) then it would have to be perfectly normal. The difficulty I have with making this into a proof is that there's no requirement that the function $g$ be zero on the complement. Finally, note that metric spaces are perfectly normal so this supersedes my earlier proof. I leave it up, though, in case it's of use to anyone to see the workings as well as the current state. (Actually, for the record I ought to declare that initially I thought that this was false for almost all spaces. However, once I'd examined my counterexample closely, I realised my error and now I'm having difficulty thinking of a reasonable space where it does not hold.) 


I tried a bit of thinking, but I haven't worked all the details. I have a hint though that may lead to the answer of your question. You may want to regard the continuous functions over an open set as a ring. This ring is reduced and commutative (thus there is a socalled rational completion) and we could then look at rational completion of them and this may lead to an answer. A good and downloadable reference of this is found here. A classical reference (and also the best one) is the book of Lambek "Lectures on Rings and Modules" by Lambek (please don't confuse it with the book of Lam, who happens to have the same first 3 letters in his last name, entitled "Lectures on Modules and Rings"), see for instance sections 2.3 and 4.4 of the book. A few years ago, I had written a small entry in Planetmath that characterized rational extensions of commutative reduced rings. And you can use that as an easy definition. 

