It's technically more challenging than that…
A creature that attempts to activate a spell-like ability—like the warlock invocation eldritch blast (Complete Arcane 7)—while it's grappled exercises the grapple option cast a spell (Player's Handbook 156) because spell-like abilities "are magical and work just like
spells" (Monster Manual 315) and because "[u]sing a spell-like ability… works like casting a spell…" (PH 142).
With this in mind, a warlock must possess the feat Sudden Still (CAr 83) to even consider activating any of his invocations (like eldritch blast) while in a grapple because "somatic components [are] required for warlock invocations" (CAr 7), and while grappled a spell can be cast (and, likewise, a spell-like ability can be activated) only if "it has no somatic component" (PH 156). (The warlock is very nearly unique in his need here for the Sudden Still feat: most spell-like abilities simply have no components at all!)
Thus the grappled warlock must first employ the benefit of the feat Sudden Still so as to enable him to make a Concentration skill check to activate the spell-like ability eldritch blast (DC 21). Failure means that the blast fails. Success means that the warlock activates the eldritch blast; because the warlock activated a spell-like ability, he provokes attacks of opportunity from opponents who threaten him—in this case, that's the black pudding that's not grappling him. (The black pudding that's grappling the warlock doesn't also threaten an area unless it's used its special ability improved grab to suffer a −20 penalty on its grapple check to grapple the warlock.)
The warlock can try to activate that spell-like ability by casting on the defensive (also see PH 142), attempting to avoid provoking attacks of opportunity for the spell-like ability's activation by making a second Concentration skill check (DC 16) after succeeding on the first. Failure on this second Concentration skill check also means that the blast fails. Success means that activating the spell-like ability provokes no attacks of opportunity. Alternatively, as this answer mentions, a warlock that possesses the feat Quicken Spell-like Ability (eldritch blast) (Monster Manual 304) could opt to use that feat's benefit to employ the blast as a swift action so that its activation doesn't provoke attacks of opportunity. (Casting a quickened spell doesn't provoke attacks of opportunity therefore neither does activating a quickened spell-like ability.)
Finally, the warlock provokes attacks of opportunity from all opponents who threaten the warlock for making a ranged attack using the blast. (This likely won't matter if the oozes are the only opponents—most oozes have Intelligence as a nonability therefore they don't gain feats so they won't usually have, for example, the feat Combat Reflexes (PH 92); the ooze outside the grapple will probably make its attack of opportunity when the warlock activates—rather than attacks with—the blast.)
…But it might be better for everyone to simplify things
This is, obviously, enormously complicated… and not a whole lot of fun. (Seriously, only the most paranoid or feat-rich warlock takes the feat Sudden Still of all things!) A DM that allows the warlock to just go ahead and blaze away with his blast while the warlock's grappled yet only provoke attacks of opportunity for activating the spell-like ability and making the ranged attack does the warlock's player—and, perhaps, all the players, including himself—a tremendous favor.
Note: A stricter reading forbids entirely activating a spell-like ability while in a grapple as use a spell-like ability just isn't an option If You're Grappling, but this DM urges If You're Grappling not be read as an exhaustive list of options! Also, that spell-like abilities are treated like spells while a creature is in a grapple is confirmed (yet consider the source) by the Rules of the Game Web column "All about Grappling (Part Two)" by D&D 3e co-designer Skip Williams. In addition, Complete Arcane errata gives the typical eldritch blast a spell level of 1, but this spell level can be higher; this answer assume the typical blast for convenience. Finally, be sure your next PC (or this one if he survives) has from the Magic Item Compendium an anklet of translocation (71) for situations just like this; it's probably the best 1,400 gp your PC will ever spend.