Let $(X,\mathscr O_X)$ be a non singular, integral projective curve over a finite field $k$ and let $K$ be the function field of $X$. One can define the invertible sheaf of differential forms on $X$ which is denoted by $\Omega_{X}$. The $K$-vector space of rational sections of $\Omega_X$ is the $K$-vector space of Kahler differentials $\Omega_{K|k}$. One can show that $\Omega_{K|k}$ is one dimensional.
Here my problem. Let $\omega\in\Omega_{K|k} $, it seems that there are two different ways to define $\operatorname{div }(\omega)\in\operatorname{Div} (X)$:
By using a local trivialization $\{U_i\}$ of $\Omega_{X}$, the element $\omega$ is the "glueing" of some elements $g_i\in\mathscr K(U_i)$, where $\mathscr K$ is the so called sheaf of stalks of rational (or meromorphic) sections, therefore we can define: $$\operatorname{div }(\omega)=\sum_{x\in X}v_x(g_i)[x]\quad \text{if } x\in U_i$$ where $v_x(g_i)$ is well defined, indeed $v_x(g_i)= v_x(g_j)$ when $x\in U_i\cap U_j$. By the Riemann-Roch theorem, $\operatorname{div }(\omega)$ has degree $2g-2$.
Write $\omega=fdt$ , then put $$\operatorname{div }(\omega)=\sum_{x\in X} v_x(f)[x]$$ In this case, thanks to the product fromula on global fields, $\operatorname{div }(\omega)$ has degree $0$.
To be honest I'm very confused, I don't understand why we get two different divisors. I suspect that the problem is in the point $2.$ Here for some strange reason I cannot apply the product formula, but I don't understand why.
Where did you get the second definition? It is not correct.
To make it correct, for each place $x$ of $X$, one chooses a local parameter $t_x $ and writes $\omega = f_x\, dt_x$. Then, the order of $\omega$ at $x$ is $v_x(f_x)$. [Can you see how this relates to definition 1?]
For instance, when $X = \mathbf P^1_k$ with function field $k(t)$, let $\omega = dt$.
Note that our computation is consistent with the fact that the canonical divisor of a curve of genus zero has degree $-2$.