Definition of L-function attached to automorphic representation Suppose $\pi$ is an irreducible automorphic representation of a reductive connected algebraic group $G$ over $\mathbb{A}_K$, here $K$ is a number field, $\mathbb{A}_K$ denotes its adeles. We have a restricted tensor product decomposition of $\pi=\otimes\pi_v$, where $\pi_v$ is an irreducible admissible representation for $G(K_v)$, and for all but finitely many $v$, $\pi_v$ is unramified.
We know how to define local L-factors at $v$ is $\pi_v$ is unramified, and we also know how to define local L-factors at archimedean places because of Langlands classification. So the question is how to define L-factors at ramified places?
As far as I know, at least for $GL_n$, we can define it as the gcd of some family of integrals via integral representation of L-function.
 A: This question was posted a while back but I just saw it. Here are some thoughts. In practice there are a couple of methods to construct L functions for local ramified representations. The first one is the Langlands-Shahidi method which works for "generic representations" of quasi-split groups and the second one is the method of integral representations (Rankin-Selberg method, Shimura's integral and the doubling method, etc). It is probably a bit painful to give a meaningful description of these two methodologies in such a limited space, so instead let me refer you to a couple of places where you can see accessible accounts of the two approaches.  A good reference for the basics of the Langlands-Shahidi method is the beautiful monograph "Analytic properties of automorphic L functions" by Gelbart and Shahidi. The same reference has a nice introduction to the method of integral representations. Dan Bump has written two very informative survey papers on the Rankin-Selberg method. Cogdell's ICTP lectures on the Rankin-Selberg method are lovely. Another good book to look at is the AMS book by Cogdell, Kim, Murty.  
As it stands there is no Langlands-Shahidi method for non-generic representations. What is missing from the picture is a good supply of easy to use unique models, like the Whittaker model in the generic setting. For orthogonal groups, however, recent progress by Waldspurger and others on the Gross-Prasad conjectures gives one the hope that maybe one can now develop a Langlands-Shahidi method, although there are serious obstacles to deal with. 
Most of the integral representations known to mankind too are closely linked with unique models (Whittaker, Bessel, etc). Sakellaridis has a theory that "explains" (some) integral representations in terms of spherical subgroups of reductive groups. 
A: As far as I understand, attaching an $L$-function to an automorphic representation attached to a general reductive group $G$ is conjectural and still open.
The way one attaches $L$-function depends on a representation $r$ of ${^L}G$ and partitioning the set of irreducible admissible representations of $G(k_v)$ into $L$-packets (which is conjectural in general and known in very few cases). Assuming one can define local $L$-packets, Borel and Tate's article in Corvalis explains how to attach $L$-function to it. But still this $L$-function depends on the chosen representation $r$.
If $\pi$ is an irreducible admissible representation of $G_A$ then $\pi= \otimes_v \pi_v$, where $\pi_v$ is an irreducible admissible representation of $G(k_v)$. So assuming we can partition the set of irreducible admissible representations of $G(k_v)$ into $L$-packets, $\pi_v$ belongs to $L$-packet $\Pi_{\phi_v}$  corresponding to some admissible homomorphism $\phi_v$ of Weil-Deligne group to ${^L}G/k_v$ . The repesentation $r$ defines a representation $r_v$ of ${^L}G/k_v$.
Then the $L$-function attached to $\pi$ and $r$ is defined as:
$L(s,\pi,r) = \prod_v L(s,\pi_v,r_v)$,
$L(s,\pi_v,r_v)=L(s, r_v \circ \phi_v)$
Now $r_v \circ \phi_v$ is a representation of Weil-Deligne group, so by Tate's article in Corvalis, we know local $L$-factor.
A: I think you're slightly misled. $\pi$ doesn't have an $L$-function "in abstracta". An unramified $\pi_v$ at a finite place $v$ gives rise, by Langlands' interpretation of the Satake isomorphism, to a semi-simple conjugacy class in the local $L$-group (or, more fancily, to an unramified representation of the local Weil[-Deligne] group [with N=0]), and that's not enough for an Euler factor. So what one does is also fixes a representation $r:{}^LG\to GL_n(\mathbf{C})$. Now one has an $L$-function $L(\pi,r,s)$, it depends on both $\pi$ and $r$ though. For example, if you choose a modular elliptic curve over the rationals, but let $r$ be the bazillion'th tensor power of the standard 2-dimensional representation of $GL_2$, you have an $L$-function which no-one knows how to analytically continue.
But the real answer to your question is that this is an open problem. One would like to say that by functoriality there is a representation $r_*(\pi)$ on $GL_n$ and you use standard definitions of $L$-functions on $GL_n$. However the existence of $r_*(\pi)$ is a fundamental open problem: Langlands functoriality. Defining local $L$-functions at the ramified places is a tiny tiny piece of this open problem, but as far as I know it's also open.
