Let $S$ be a smooth surface (let's say over an algebraically closed field) and let $D$ be a smooth divisor in $S$. Let also $G$ be a connected algebraic group. Assume that we are given a principal $G$bundle ${\mathcal F}$ on $S\backslash D$. Under what conditions can we extend it to all of $S$? Do I understand correctly, that this is always the case when the derived group $[G,G]$ is simply connected?

Just a quick idea on how I would proceed if the field was $\mathbb{C}$. Let see $S=S\setminus\mathcal{N}(D)\cup \mathcal{N}(D)$ where $\mathcal{N}(D)$ is a normal neighborhood of $D$. You have a $G$ principal bundle $\mathcal{F}$ over $S\setminus\mathcal{N}(D)$ and you want to extend it to all $S$. Basically you could do so if there is a $G$ principal bundle, $P$, over $S$ such that $\pi^*(P)=\mathcal{F}\vert_{\partial\mathcal{N}(D)}$ where $\pi$ is the natural projection from $\partial\mathcal{N}(D)$ to $D$. I have the feeling that the only obstruction is that $\mathcal{F}$ has to be trivial when restricted to the fibers of the unit normal neighborhood of $D$ in $S$. As we are talking about surfaces then $S$ is of real dimension $4$, if $D$ is of real dimension $2$ then those fiber have dimension $1$. And since you assumed that $G$ was connected then it is necessarily trivial on the fibers... This is just some thought maybe I'm wrong... 


For extension across codimension 2 points, in the case of a reductive group, you can use Hartog's theorem / S_2 extension. As t3suji suggests, you embed G into GL_n and first extend the GL_nbundle to a bundle E defined over all of S. Via its embedding in GL_n, G acts on E. Form the quotient space E/G. Then the original Gbundle structure away from D gives a rational section of E/G. Since G is reductive, E/G is affine over S. So if you extend your section of E/G at codim 1 points, then Hartog's theorem extends across codim 2 points. And the inverse image of this section of E/G in E is an extension of your original Gbundle. 


Wait, are you assuming that G is a reductive group whose derived group is simply connected? In that case, I believe Serre's Conjecture II implies that the Gtorsor is trivial over a dense Zariski open subset of S. So you can extend it across the codimension 1 points as a trivial torsor. P.S. Sorry for writing this as a separate answer, as opposed to a reply to Sasha's comment, but I don't know how to make replies in MathOverflow (maybe you need to be registered). 


Nick ShepherdBarron once asked me this question, and I think I can remember what was eventually concluded. The short answer to the original question is negative for the additive group $\mathbb{G_a}$. Map $SL_2(\mathbb{C})$ to $X=\mathbb{C}^2(0,0)$ by letting a matrix act on the vector $(1,0)^T$. This realizes the group as a torsor over $X$ for the group of unipotent matrices \[ \begin{pmatrix} 1 & a \\\\ 0& 1 \end{pmatrix}. \] We can trivialize it over the vectors $(v_1,v_2)^T$ with $v_1\neq 0$ with the section \[ \begin{pmatrix} v_1 & 0 \\\\ v_2& v_1^{1} \end{pmatrix},\] while it trivializes on the set $v_2\neq 0$ via the section \[\begin{pmatrix} v_1 & v_2^{1} \\\\ v_2& 0 \end{pmatrix}.\] The transition function on the overlap is easliy computed to be \[\begin{pmatrix} 1 & (v_1v_2)^{1}\\\\ 0& 1 \end{pmatrix}.\] This represents the standard nontrivial generator of $H^1(O_X)$, and hence, the bundle is nontrivial. On the other hand, if you could extend it to $\mathbb{C}^2$, it would trivialize, since there are no nontrivial $\mathbb{G}_a$bundles on an affine variety. There is indeed a correspondence between principal bundles and tensor functors from representations to vector bundles. But if I recall correctly, the functor is required to be exact. In the case at hand, the extension of vector bundles is the direct image with respect to the inclusion $X\hookrightarrow \mathbb{C}^2$, which fails this. Added: OK, I see this was just an elaborate way to say: take any principal $\mathbb{G}_a$bundle corresponding to a nonzero element of $H^1(O_X)$. Note, anyways, that the derived group is trivial in this example. Certainly the statement is false for general connected groups, contrary to some of the comments. Added, 25, November, 2011: This question came back to me today while I was thinking about something unrelated. It occurred to me then to point out that for the example above, if we work in the analytic category, we have $$H^1(X, \mathbb{G}_a)\simeq H^1(X, \mathbb{G}_m),$$ via the exponential sequence. On the other hand, $$H^1(\mathbb{C}^2, \mathbb{G}_a)=H^1(\mathbb{C}^2, \mathbb{G}_m)=0.$$ So the desired extension property is false on analytic spaces even for reductive structure groups. 

