**Find and remove**

The fcurves collection of an action has a method to find fcurves from data path and index, and a remove method.


The same action can be linked to multiple objects, so will use a set to find all the actions' fcurves.


There really is no need to look at the group, location x keyframes have data path 'location' and array_index 0.

Test code. Since you mention you are going to convert this to an operator have added the context variable `context = bpy.context`  Once test code works, lose this and use the context argument passed to operator/panel methods, when pasting into operator code.


    import bpy

    context = bpy.context

    data_path = "location"
    index = 0 # location.x or location[0]

    #objects = bpy.data.objects # all
    #objects = context.scene.objects # all in scene
    objects = context.selected_objects # selected

    all_fcurves = set(
        o.animation_data.action.fcurves for o in objects
        if o.animation_data and o.animation_data.action
        )

    for fcurves in all_fcurves:
        fcurve = fcurves.find(data_path, index=index)
        if fcurve:
            fcurves.remove(fcurve)

for bones the data path is akin to

    'pose.bones["Bone"].location`

in which case to find  x location keyframe it could be simpler to replace the find method with 

    def find(fcurves, data_path, index):
        x = [fc for fc in fcurves 
             if fc.data_path.endswith(datapath) 
             and fc.array_index == index]
        return x.pop() if x else None